summaryrefslogtreecommitdiff
path: root/src/Propellor/Property.hs
diff options
context:
space:
mode:
authorJoey Hess2015-10-10 11:40:12 -0400
committerJoey Hess2015-10-10 11:40:12 -0400
commit349e675a499187379ddb14c5f6ce8203de10183e (patch)
tree44f9eed959335dca27bb35947a952c3ca9f97efb /src/Propellor/Property.hs
parentea29beecfeebf304e544ab588da43fa66d83fd43 (diff)
Improved documentation, particularly of the Propellor module.
This involved some code changes, including some renaming of instance methods. (ABI change)
Diffstat (limited to 'src/Propellor/Property.hs')
-rw-r--r--src/Propellor/Property.hs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Propellor/Property.hs b/src/Propellor/Property.hs
index e8d70a80..3ab66ca3 100644
--- a/src/Propellor/Property.hs
+++ b/src/Propellor/Property.hs
@@ -39,6 +39,18 @@ flagFile' p getflagfile = adjustPropertySatisfy p $ \satisfy -> do
writeFile flagfile ""
return r
+-- | Indicates that the first property depends on the second,
+-- so before the first is ensured, the second must be ensured.
+requires :: Combines x y => x -> y -> CombinedType x y
+requires = (<<>>)
+
+-- | Combines together two properties, resulting in one property
+-- that ensures the first, and if the first succeeds, ensures the second.
+--
+-- The combined property uses the description of the first property.
+before :: (IsProp x, Combines y x, IsProp (CombinedType y x)) => x -> y -> CombinedType y x
+before x y = (y `requires` x) `describe` getDesc x
+
-- | Whenever a change has to be made for a Property, causes a hook
-- Property to also be run, but not otherwise.
onChange