summaryrefslogtreecommitdiff
path: root/src/Propellor/Property.hs
diff options
context:
space:
mode:
authorSean Whitton2016-06-16 21:17:21 +0900
committerSean Whitton2016-06-16 21:17:21 +0900
commit0e452bb50b4718829b904af4ee26c8a4d77abea1 (patch)
treef7a3c950bebe4fb74733615f1a0ecccbc10ceb7c /src/Propellor/Property.hs
parent942a65ab9f9847897abbd2c8515f349465c33843 (diff)
applyToList combinator
I think Joey wrote this at some point .. though it's possible I did
Diffstat (limited to 'src/Propellor/Property.hs')
-rw-r--r--src/Propellor/Property.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Propellor/Property.hs b/src/Propellor/Property.hs
index af36ed58..3fff9e04 100644
--- a/src/Propellor/Property.hs
+++ b/src/Propellor/Property.hs
@@ -16,6 +16,7 @@ module Propellor.Property (
, check
, fallback
, revert
+ , applyToList
-- * Property descriptions
, describe
, (==>)
@@ -341,6 +342,14 @@ unsupportedOS' = go =<< getOS
revert :: RevertableProperty setup undo -> RevertableProperty undo setup
revert (RevertableProperty p1 p2) = RevertableProperty p2 p1
+-- | Apply a property to each element of a list.
+applyToList
+ :: (Foldable t, Functor t, IsProp p, Combines p p, p ~ CombinedType p p)
+ => (b -> p)
+ -> t b
+ -> p
+prop `applyToList` xs = foldr1 before $ prop <$> xs
+
makeChange :: IO () -> Propellor Result
makeChange a = liftIO a >> return MadeChange