diff options
| author | Joey Hess <joeyh@joeyh.name> | 2016-03-26 18:54:18 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2016-03-26 18:54:18 -0400 |
| commit | 42da8445470a6e4950873fc5d6bea88646ec2b63 (patch) | |
| tree | 760e2edb877e540c656257d5d48dce08b15a21f9 /src/Propellor | |
| parent | 009cff24bd7a43a5a35300af7a22a99570840195 (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')
| -rw-r--r-- | src/Propellor/PrivData.hs | 6 | ||||
| -rw-r--r-- | src/Propellor/Types.hs | 15 |
2 files changed, 16 insertions, 5 deletions
diff --git a/src/Propellor/PrivData.hs b/src/Propellor/PrivData.hs index 5e6e0869..77c7133f 100644 --- a/src/Propellor/PrivData.hs +++ b/src/Propellor/PrivData.hs @@ -127,11 +127,7 @@ withPrivData' feed srclist c mkprop = addinfo $ mkprop $ \a -> "Fix this by running:" : showSet (map (\s -> (privDataField s, Context cname, describePrivDataSource s)) srclist) return FailedChange - addinfo p = Property undefined -- FIXME: should use sing here - (propertyDesc p) - (getSatisfy p) - (propertyInfo p `addInfo` privset) - (propertyChildren p) + addinfo p = p `addInfoProperty'` (toInfo privset) privset = PrivInfo $ S.fromList $ map (\s -> (privDataField s, describePrivDataSource s, hc)) srclist fieldnames = map show fieldlist 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 |
