diff options
| author | Joey Hess <joey@kitenet.net> | 2014-04-15 15:08:40 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-04-15 15:08:40 -0400 |
| commit | ba058d77a778058887f5c678b10e3c5ac599c50c (patch) | |
| tree | f841754cb52d41ccafee719a1fc0b47c766ad7b2 /Propellor/Property.hs | |
| parent | a1e3c4e9e060c58a738501030a197557e20e88db (diff) | |
| parent | 0592ab4bd7deaadaa971bc7d19b7beaca5a1253e (diff) | |
Merge branch 'joeyconfig'
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. -- |
