diff options
Diffstat (limited to 'src/Propellor/Property.hs')
| -rw-r--r-- | src/Propellor/Property.hs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Propellor/Property.hs b/src/Propellor/Property.hs index c7fc555f..471916d0 100644 --- a/src/Propellor/Property.hs +++ b/src/Propellor/Property.hs @@ -12,6 +12,7 @@ import "mtl" Control.Monad.RWS.Strict import Propellor.Types import Propellor.Info +import Propellor.Exception import Utility.Monad -- | Constructs a Property, from a description and an action to run to @@ -109,6 +110,13 @@ describe = setDesc (==>) = flip describe infixl 1 ==> +-- | For when code running in the Propellor monad needs to ensure a +-- Property. +-- +-- This can only be used on a Property that has NoInfo. +ensureProperty :: Property NoInfo -> Propellor Result +ensureProperty = catchPropellor . propertySatisfy + -- | Makes a Property only need to do anything when a test succeeds. check :: IO Bool -> Property i -> Property i check c p = adjustPropertySatisfy p $ \satisfy -> ifM (liftIO c) |
