diff options
| author | Joey Hess <joey@kitenet.net> | 2014-03-30 02:26:23 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-03-30 02:28:08 -0400 |
| commit | 0039fb6b5623fc7a690fa2a2d3fe20214de236d6 (patch) | |
| tree | a262465f02d245943e943cd91926992660e46713 /Property.hs | |
| parent | d50e4dedb20054877916191d66d537defb738667 (diff) | |
property lists
Diffstat (limited to 'Property.hs')
| -rw-r--r-- | Property.hs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/Property.hs b/Property.hs index 6a6bb3b7..f7dcccde 100644 --- a/Property.hs +++ b/Property.hs @@ -38,6 +38,16 @@ propertyDesc (FileProperty d _ _) = d propertyDesc (CmdProperty d _ _ _) = d propertyDesc (IOProperty d _) = d +{- Combines a list of properties, resulting in a single property + - that when run will run each property in the list in turn, + - and print out the description of each as it's run. Does not stop + - on failure; does propigate overall success/failure. + -} +propertyList :: Desc -> [Property] -> Property +propertyList desc ps = IOProperty desc $ ensureProperties' ps + +{- Combines a list of properties, resulting in one property that + - ensures each in turn, stopping on failure. -} combineProperties :: Desc -> [Property] -> Property combineProperties desc ps = IOProperty desc $ go ps NoChange where @@ -71,10 +81,13 @@ ensureProperty' (IOProperty _ a) = a ensureProperties :: [Property] -> IO () ensureProperties ps = do - r <- ensure ps NoChange + r <- ensureProperties' ps case r of FailedChange -> exitWith (ExitFailure 1) _ -> exitWith ExitSuccess + +ensureProperties' :: [Property] -> IO Result +ensureProperties' ps = ensure ps NoChange where ensure [] rs = return rs ensure (l:ls) rs = do |
