diff options
| author | Joey Hess <joey@kitenet.net> | 2014-04-08 18:41:30 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-04-08 18:41:30 -0400 |
| commit | 39f3acd6e473ee25e6c37fd5c8a5b4237d34127c (patch) | |
| tree | 902458fd78162103b962b1ef730c4157f2ca5aa9 /Propellor/Property.hs | |
| parent | 27a00f86826f7f76afc05d02c8990ac38c0802fd (diff) | |
propellor spin
Diffstat (limited to 'Propellor/Property.hs')
| -rw-r--r-- | Propellor/Property.hs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Propellor/Property.hs b/Propellor/Property.hs index e7ec704d..c2a8972e 100644 --- a/Propellor/Property.hs +++ b/Propellor/Property.hs @@ -33,6 +33,16 @@ combineProperties desc ps = Property desc $ go ps NoChange FailedChange -> return FailedChange _ -> go ls (r <> rs) +-- | Combines together two properties, resulting in one property +-- that ensures the first, and if the first succeeds, ensures the second. +-- The property uses the description of the first property. +before :: Property -> Property -> Property +p1 `before` p2 = Property (propertyDesc p1) $ do + r <- ensureProperty p1 + case r of + FailedChange -> return FailedChange + _ -> ensureProperty p2 + -- | Makes a perhaps non-idempotent Property be idempotent by using a flag -- file to indicate whether it has run before. -- Use with caution. |
