diff options
| author | Joey Hess <joey@kitenet.net> | 2014-04-14 14:09:41 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-04-14 14:09:41 -0400 |
| commit | d71f8caad4576ff55a147d7d7934c8bc436519de (patch) | |
| tree | 9ca849b546169c3406061d3b0fc42e9680d55af4 /Propellor/Property.hs | |
| parent | 0f08c035c7bafe13b59e3e91b426e93ee8e5092a (diff) | |
propellor spin
Diffstat (limited to 'Propellor/Property.hs')
| -rw-r--r-- | Propellor/Property.hs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Propellor/Property.hs b/Propellor/Property.hs index 95d17c05..5b1800ef 100644 --- a/Propellor/Property.hs +++ b/Propellor/Property.hs @@ -92,6 +92,19 @@ check c property = Property (propertyDesc property) $ ifM (liftIO c) , return NoChange ) +-- | Marks a Property as trivial. It can only return FailedChange or +-- NoChange. +-- +-- Useful when it's just as expensive to check if a change needs +-- to be made as it is to just idempotently assure the property is +-- satisfied. For example, chmodding a file. +trivial :: Property -> Property +trivial p = Property (propertyDesc p) $ do + r <- ensureProperty p + if r == MadeChange + then return NoChange + else return r + -- | Makes a property that is satisfied differently depending on the host's -- operating system. -- |
