store PropList reversed to optimise &
PropList is now an opaque type, to prevent misuse. Note that the PropAccum Host instance cannot use reversed order.
This commit is contained in:
parent
62c093de30
commit
7da64306a0
|
@ -1,6 +1,13 @@
|
||||||
{-# LANGUAGE PackageImports #-}
|
{-# LANGUAGE PackageImports #-}
|
||||||
|
|
||||||
module Propellor.PropAccum where
|
module Propellor.PropAccum
|
||||||
|
( host
|
||||||
|
, props
|
||||||
|
, PropAccum(..)
|
||||||
|
, (!)
|
||||||
|
, PropList
|
||||||
|
, propigateContainer
|
||||||
|
) where
|
||||||
|
|
||||||
import Data.Monoid
|
import Data.Monoid
|
||||||
|
|
||||||
|
@ -47,9 +54,9 @@ instance PropAccum Host where
|
||||||
data PropList = PropList [Property HasInfo]
|
data PropList = PropList [Property HasInfo]
|
||||||
|
|
||||||
instance PropAccum PropList where
|
instance PropAccum PropList where
|
||||||
PropList l & p = PropList (l ++ [toProp p])
|
PropList l & p = PropList (toProp p : l)
|
||||||
PropList l &^ p = PropList ([toProp p] ++ l)
|
PropList l &^ p = PropList (l ++ [toProp p])
|
||||||
getProperties (PropList l) = l
|
getProperties (PropList l) = reverse l
|
||||||
|
|
||||||
-- | Adds a property in reverted form.
|
-- | Adds a property in reverted form.
|
||||||
(!) :: PropAccum h => h -> RevertableProperty -> h
|
(!) :: PropAccum h => h -> RevertableProperty -> h
|
||||||
|
|
Loading…
Reference in New Issue