diff options
| author | Joey Hess <joeyh@joeyh.name> | 2016-02-08 11:18:25 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2016-02-08 11:18:25 -0400 |
| commit | 719ee1c96ddfbe9e926a78a40d477fd429947c6f (patch) | |
| tree | 6da39e5d64eaf01b731d1e1abd4d88ad1c4aae50 /src | |
| parent | 16a674dab73893657f040bbd15a04bf0ec5c44a7 (diff) | |
| parent | b33807cec25f232d5bd43fea6e954d596acbad24 (diff) | |
Merge branch 'joeyconfig'
Diffstat (limited to 'src')
| -rw-r--r-- | src/Propellor/Property/List.hs | 10 | ||||
| -rw-r--r-- | src/Propellor/Types.hs | 5 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/Propellor/Property/List.hs b/src/Propellor/Property/List.hs index 86fdfbf1..74aa6ca6 100644 --- a/src/Propellor/Property/List.hs +++ b/src/Propellor/Property/List.hs @@ -50,6 +50,8 @@ class PropertyList l where type family PropertyListType t type instance PropertyListType [Property HasInfo] = HasInfo type instance PropertyListType [Property NoInfo] = NoInfo +type instance PropertyListType [RevertableProperty NoInfo] = NoInfo +type instance PropertyListType [RevertableProperty HasInfo] = HasInfo type instance PropertyListType PropList = HasInfo instance PropertyList [Property NoInfo] where @@ -63,6 +65,14 @@ instance PropertyList [Property HasInfo] where propertyList desc ps = infoProperty desc (ensureProperties $ map ignoreInfo ps) mempty ps combineProperties desc ps = infoProperty desc (combineSatisfy ps NoChange) mempty ps +instance PropertyList [RevertableProperty HasInfo] where + propertyList desc ps = propertyList desc (map setupRevertableProperty ps) + combineProperties desc ps = combineProperties desc (map setupRevertableProperty ps) + +instance PropertyList [RevertableProperty NoInfo] where + propertyList desc ps = propertyList desc (map setupRevertableProperty ps) + combineProperties desc ps = combineProperties desc (map setupRevertableProperty ps) + instance PropertyList PropList where propertyList desc = propertyList desc . getProperties combineProperties desc = combineProperties desc . getProperties diff --git a/src/Propellor/Types.hs b/src/Propellor/Types.hs index 35e95df7..f224c8ba 100644 --- a/src/Propellor/Types.hs +++ b/src/Propellor/Types.hs @@ -182,7 +182,10 @@ propertyChildren (SProperty _ _ cs) = cs -- | A property that can be reverted. The first Property is run -- normally and the second is run when it's reverted. -data RevertableProperty i = RevertableProperty (Property i) (Property i) +data RevertableProperty i = RevertableProperty + { setupRevertableProperty :: Property i + , undoRevertableProperty :: Property i + } instance Show (RevertableProperty i) where show (RevertableProperty p _) = show p |
