summaryrefslogtreecommitdiff
path: root/Propellor/Property.hs
diff options
context:
space:
mode:
authorJoey Hess2014-04-01 17:32:37 -0400
committerJoey Hess2014-04-01 17:32:37 -0400
commitb70422c8cfb082687eaa6d4051c27d430c24f36b (patch)
tree6d952c4101b1531435fe896e611b544f3a9a5962 /Propellor/Property.hs
parenta69b0a2cc89aa3e839e8abd2e4cec7a05d8d18cf (diff)
fix desc for combineProperties
Diffstat (limited to 'Propellor/Property.hs')
-rw-r--r--Propellor/Property.hs9
1 files changed, 3 insertions, 6 deletions
diff --git a/Propellor/Property.hs b/Propellor/Property.hs
index a1b871c2..2764d614 100644
--- a/Propellor/Property.hs
+++ b/Propellor/Property.hs
@@ -23,8 +23,8 @@ propertyList desc ps = Property desc $ ensureProperties' ps
-- | Combines a list of properties, resulting in one property that
-- ensures each in turn, stopping on failure.
-combineProperties :: [Property] -> Property
-combineProperties ps = Property desc $ go ps NoChange
+combineProperties :: Desc -> [Property] -> Property
+combineProperties desc ps = Property desc $ go ps NoChange
where
go [] rs = return rs
go (l:ls) rs = do
@@ -32,9 +32,6 @@ combineProperties ps = Property desc $ go ps NoChange
case r of
FailedChange -> return FailedChange
_ -> go ls (r <> rs)
- desc = case ps of
- (p:_) -> propertyDesc p
- _ -> "(empty)"
-- | Makes a perhaps non-idempotent Property be idempotent by using a flag
-- file to indicate whether it has run before.
@@ -64,7 +61,7 @@ property `onChange` hook = Property (propertyDesc property) $ do
-- | Indicates that the first property can only be satisfied once
-- the second is.
requires :: Property -> Property -> Property
-x `requires` y = combineProperties [y, x] `describe` propertyDesc x
+x `requires` y = combineProperties (propertyDesc x) [y, x]
describe :: Property -> Desc -> Property
describe p d = p { propertyDesc = d }