summaryrefslogtreecommitdiff
path: root/src/Propellor/Types.hs
diff options
context:
space:
mode:
authorJoey Hess2016-03-26 18:54:18 -0400
committerJoey Hess2016-03-26 18:54:18 -0400
commit42da8445470a6e4950873fc5d6bea88646ec2b63 (patch)
tree760e2edb877e540c656257d5d48dce08b15a21f9 /src/Propellor/Types.hs
parent009cff24bd7a43a5a35300af7a22a99570840195 (diff)
got rid of the undefined in privdata
addInfoProperty' is like addInfoProperty but for when the input property is already known to HasInfo.
Diffstat (limited to 'src/Propellor/Types.hs')
-rw-r--r--src/Propellor/Types.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/Propellor/Types.hs b/src/Propellor/Types.hs
index 4b3f665a..ccbfd3e0 100644
--- a/src/Propellor/Types.hs
+++ b/src/Propellor/Types.hs
@@ -25,6 +25,8 @@ module Propellor.Types
, HasInfo
, type (+)
, addInfoProperty
+ , addInfoProperty'
+ , addChildrenProperty
, adjustPropertySatisfy
, propertyInfo
, propertyDesc
@@ -159,6 +161,19 @@ addInfoProperty
addInfoProperty (Property _ d a oldi c) newi =
Property sing d a (oldi <> newi) c
+-- | Adds more info to a Property that already HasInfo.
+addInfoProperty'
+ :: (IncludesInfo metatypes ~ 'True)
+ => Property metatypes
+ -> Info
+ -> Property metatypes
+addInfoProperty' (Property t d a oldi c) newi =
+ Property t d a (oldi <> newi) c
+
+-- | Adds children to a Property.
+addChildrenProperty :: Property metatypes -> [ChildProperty] -> Property metatypes
+addChildrenProperty (Property t s a i cs) cs' = Property t s a i (cs ++ cs')
+
-- | Changes the action that is performed to satisfy a property.
adjustPropertySatisfy :: Property metatypes -> (Propellor Result -> Propellor Result) -> Property metatypes
adjustPropertySatisfy (Property t d s i c) f = Property t d (f s) i c