diff options
| author | Joey Hess <joeyh@joeyh.name> | 2016-03-24 20:20:26 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2016-03-24 20:20:26 -0400 |
| commit | 16ea40620ef2dbd62a2e8d5d8eb153e03d0c5848 (patch) | |
| tree | 741754986e60b4e5e451da2573384840c5575b35 | |
| parent | b7655817371807ed44e89a3dd52a30846544832a (diff) | |
ported most of PropAccum
| -rw-r--r-- | src/Propellor/PropAccum.hs | 17 | ||||
| -rw-r--r-- | src/Propellor/Types.hs | 7 |
2 files changed, 16 insertions, 8 deletions
diff --git a/src/Propellor/PropAccum.hs b/src/Propellor/PropAccum.hs index 85a30af5..7c838c92 100644 --- a/src/Propellor/PropAccum.hs +++ b/src/Propellor/PropAccum.hs @@ -6,7 +6,7 @@ module Propellor.PropAccum , (&) , (&^) , (!) - , propagateContainer + --, propagateContainer ) where import Data.Monoid @@ -33,7 +33,7 @@ class PropAccum h where -- | Like addProp, but adds the property at the front of the list. addPropFront :: IsProp p => h -> p -> h - getProperties :: h -> [Property HasInfo] + getProperties :: h -> [ChildProperty] -- | Adds a property to a `Host` or other `PropAccum` -- @@ -46,7 +46,7 @@ class PropAccum h where (&^) = addPropFront -- | Adds a property in reverted form. -(!) :: IsProp (RevertableProperty i) => PropAccum h => h -> RevertableProperty i -> h +(!) :: IsProp (RevertableProperty undometatypes setupmetatypes) => PropAccum h => h -> RevertableProperty setupmetatypes undometatypes -> h h ! p = h & revert p infixl 1 & @@ -60,6 +60,8 @@ instance PropAccum Host where (getInfoRecursive p <> is) getProperties = hostProperties +{- + -- | Adjust the provided Property, adding to its -- propertyChidren the properties of the provided container. -- @@ -72,9 +74,10 @@ propagateContainer :: (PropAccum container) => String -> container - -> Property HasInfo - -> Property HasInfo -propagateContainer containername c prop = infoProperty + -> Property metatypes + -> Property metatypes +propagateContainer containername c prop = Property + undefined (propertyDesc prop) (propertySatisfy prop) (propertyInfo prop) @@ -86,3 +89,5 @@ propagateContainer containername c prop = infoProperty (propagatableInfo (propertyInfo p)) cs = map go (propertyChildren p) in infoProperty (propertyDesc p) (propertySatisfy p) i cs + +-} diff --git a/src/Propellor/Types.hs b/src/Propellor/Types.hs index 3ca7c8dc..743787cc 100644 --- a/src/Propellor/Types.hs +++ b/src/Propellor/Types.hs @@ -16,6 +16,7 @@ module Propellor.Types , OS(..) , UnixLike , Debian + , DebianLike , Buntish , FreeBSD , HasInfo @@ -210,24 +211,25 @@ setup <!> undo = RevertableProperty setup undo -- | Class of types that can be used as properties of a host. class IsProp p where setDesc :: p -> Desc -> p - -- toProp :: p -> Property HasInfo getDesc :: p -> Desc -- | Gets the info of the property, combined with all info -- of all children properties. getInfoRecursive :: p -> Info + toProp :: p -> ChildProperty instance IsProp (Property metatypes) where setDesc (Property t _ a i c) d = Property t d a i c - -- toProp = id getDesc = propertyDesc getInfoRecursive (Property _ _ _ i c) = i <> mconcat (map getInfoRecursive c) + toProp (Property _ d a i c) = ChildProperty d a i c instance IsProp ChildProperty where setDesc (ChildProperty _ a i c) d = ChildProperty d a i c getDesc (ChildProperty d _ _ _) = d getInfoRecursive (ChildProperty _ _ i c) = i <> mconcat (map getInfoRecursive c) + toProp = id instance IsProp (RevertableProperty setupmetatypes undometatypes) where -- | Sets the description of both sides. @@ -237,6 +239,7 @@ instance IsProp (RevertableProperty setupmetatypes undometatypes) where -- toProp (RevertableProperty p1 _) = p1 -- | Return the Info of the currently active side. getInfoRecursive (RevertableProperty p1 _p2) = getInfoRecursive p1 + toProp (RevertableProperty p1 _p2) = toProp p1 -- | Type level calculation of the type that results from combining two -- types of properties. |
