From 7da64306a0d63cc3b04381c073ab6a7732c19e1a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 25 Jan 2015 15:40:38 -0400 Subject: store PropList reversed to optimise & PropList is now an opaque type, to prevent misuse. Note that the PropAccum Host instance cannot use reversed order. --- src/Propellor/PropAccum.hs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/Propellor/PropAccum.hs') 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 -- cgit v1.2.3