diff options
| author | Joey Hess <joeyh@joeyh.name> | 2015-01-25 15:40:38 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2015-01-25 15:40:38 -0400 |
| commit | 7da64306a0d63cc3b04381c073ab6a7732c19e1a (patch) | |
| tree | fd052cf2d70c6fb5bb406e7598872384ff9842c6 /src/Propellor | |
| parent | 62c093de300b4458395c00cb1f76ac3164a0fca5 (diff) | |
store PropList reversed to optimise &
PropList is now an opaque type, to prevent misuse.
Note that the PropAccum Host instance cannot use reversed order.
Diffstat (limited to 'src/Propellor')
| -rw-r--r-- | src/Propellor/PropAccum.hs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/Propellor/PropAccum.hs b/src/Propellor/PropAccum.hs index 139f1471..20d083cb 100644 --- a/src/Propellor/PropAccum.hs +++ b/src/Propellor/PropAccum.hs @@ -1,6 +1,13 @@ {-# LANGUAGE PackageImports #-} -module Propellor.PropAccum where +module Propellor.PropAccum + ( host + , props + , PropAccum(..) + , (!) + , PropList + , propigateContainer + ) where import Data.Monoid @@ -47,9 +54,9 @@ instance PropAccum Host where data PropList = PropList [Property HasInfo] instance PropAccum PropList where - PropList l & p = PropList (l ++ [toProp p]) - PropList l &^ p = PropList ([toProp p] ++ l) - getProperties (PropList l) = l + PropList l & p = PropList (toProp p : l) + PropList l &^ p = PropList (l ++ [toProp p]) + getProperties (PropList l) = reverse l -- | Adds a property in reverted form. (!) :: PropAccum h => h -> RevertableProperty -> h |
