summaryrefslogtreecommitdiff
path: root/src/Propellor
diff options
context:
space:
mode:
authorJoey Hess2018-04-29 14:01:18 -0400
committerJoey Hess2018-04-29 14:01:18 -0400
commit45509984bb93c24a17228fd41058da7f039b54d6 (patch)
tree553239ab39c7e1bee343db44ee725f60eb2ebe88 /src/Propellor
parent279fe0fd88999919e70b07bda5f89f030dbfaaa1 (diff)
parent6b6d11a7cd4eba3adbfd4e63469f968fcfcf5dc0 (diff)
Merge branch 'master' into joeyconfig
Diffstat (limited to 'src/Propellor')
-rw-r--r--src/Propellor/DotDir.hs2
-rw-r--r--src/Propellor/Property/List.hs1
-rw-r--r--src/Propellor/Types.hs29
-rw-r--r--src/Propellor/Types/Chroot.hs3
-rw-r--r--src/Propellor/Types/Docker.hs3
-rw-r--r--src/Propellor/Types/ResultCheck.hs1
6 files changed, 29 insertions, 10 deletions
diff --git a/src/Propellor/DotDir.hs b/src/Propellor/DotDir.hs
index dc881eeb..749fcd9f 100644
--- a/src/Propellor/DotDir.hs
+++ b/src/Propellor/DotDir.hs
@@ -316,7 +316,7 @@ minimalConfig = do
]
stackResolver :: String
-stackResolver = "lts-8.22"
+stackResolver = "lts-9.21"
fullClone :: IO Result
fullClone = do
diff --git a/src/Propellor/Property/List.hs b/src/Propellor/Property/List.hs
index 758e51ce..e53b5ccb 100644
--- a/src/Propellor/Property/List.hs
+++ b/src/Propellor/Property/List.hs
@@ -20,6 +20,7 @@ import Propellor.Engine
import Propellor.Exception
import Data.Monoid
+import Prelude
toProps :: [Property (MetaTypes metatypes)] -> Props (MetaTypes metatypes)
toProps ps = Props (map toChildProperty ps)
diff --git a/src/Propellor/Types.hs b/src/Propellor/Types.hs
index b7c7c7f7..c3926229 100644
--- a/src/Propellor/Types.hs
+++ b/src/Propellor/Types.hs
@@ -43,6 +43,7 @@ module Propellor.Types (
, module Propellor.Types.ZFS
) where
+import qualified Data.Semigroup as Sem
import Data.Monoid
import Control.Applicative
import Prelude
@@ -212,14 +213,13 @@ class TightenTargets p where
instance TightenTargets Property where
tightenTargets (Property _ d a i c) = Property sing d a i c
--- | Any type of Property is a monoid. When properties x and y are
+-- | Any type of Property is a Semigroup. When properties x and y are
-- appended together, the resulting property has a description like
-- "x and y". Note that when x fails to be ensured, it will not
-- try to ensure y.
-instance SingI metatypes => Monoid (Property (MetaTypes metatypes))
+instance SingI metatypes => Sem.Semigroup (Property (MetaTypes metatypes))
where
- mempty = Property sing "noop property" Nothing mempty mempty
- mappend (Property _ d1 a1 i1 c1) (Property _ d2 a2 i2 c2) =
+ Property _ d1 a1 i1 c1 <> Property _ d2 a2 i2 c2 =
Property sing d (a1 <> a2) (i1 <> i2) (c1 <> c2)
where
-- Avoid including "noop property" in description
@@ -230,16 +230,31 @@ instance SingI metatypes => Monoid (Property (MetaTypes metatypes))
(Nothing, Just _) -> d2
(Nothing, Nothing) -> d1
--- | Any type of RevertableProperty is a monoid. When revertable
+-- | Any type of Property is a Monoid.
+instance SingI metatypes => Monoid (Property (MetaTypes metatypes))
+ where
+ -- | A property that does nothing.
+ mempty = Property sing "noop property" Nothing mempty mempty
+ mappend = (<>)
+
+-- | Any type of RevertableProperty is a Semigroup. When revertable
-- properties x and y are appended together, the resulting revertable
-- property has a description like "x and y".
-- Note that when x fails to be ensured, it will not try to ensure y.
instance
+ ( Sem.Semigroup (Property setupmetatypes)
+ , Sem.Semigroup (Property undometatypes)
+ )
+ => Sem.Semigroup (RevertableProperty setupmetatypes undometatypes)
+ where
+ RevertableProperty s1 u1 <> RevertableProperty s2 u2 =
+ RevertableProperty (s1 <> s2) (u2 <> u1)
+
+instance
( Monoid (Property setupmetatypes)
, Monoid (Property undometatypes)
)
=> Monoid (RevertableProperty setupmetatypes undometatypes)
where
mempty = RevertableProperty mempty mempty
- mappend (RevertableProperty s1 u1) (RevertableProperty s2 u2) =
- RevertableProperty (s1 <> s2) (u2 <> u1)
+ mappend = (<>)
diff --git a/src/Propellor/Types/Chroot.hs b/src/Propellor/Types/Chroot.hs
index b27203e5..b3751a9a 100644
--- a/src/Propellor/Types/Chroot.hs
+++ b/src/Propellor/Types/Chroot.hs
@@ -6,9 +6,10 @@ import Propellor.Types
import Propellor.Types.Empty
import Propellor.Types.Info
-import Data.Monoid
import qualified Data.Semigroup as Sem
import qualified Data.Map as M
+import Data.Monoid
+import Prelude
data ChrootInfo = ChrootInfo
{ _chroots :: M.Map FilePath Host
diff --git a/src/Propellor/Types/Docker.hs b/src/Propellor/Types/Docker.hs
index 79577591..72703b82 100644
--- a/src/Propellor/Types/Docker.hs
+++ b/src/Propellor/Types/Docker.hs
@@ -6,9 +6,10 @@ import Propellor.Types
import Propellor.Types.Empty
import Propellor.Types.Info
-import Data.Monoid
import qualified Data.Semigroup as Sem
import qualified Data.Map as M
+import Data.Monoid
+import Prelude
data DockerInfo = DockerInfo
{ _dockerRunParams :: [DockerRunParam]
diff --git a/src/Propellor/Types/ResultCheck.hs b/src/Propellor/Types/ResultCheck.hs
index f03c174f..8c161850 100644
--- a/src/Propellor/Types/ResultCheck.hs
+++ b/src/Propellor/Types/ResultCheck.hs
@@ -14,6 +14,7 @@ import Propellor.Exception
import Utility.Monad
import Data.Monoid
+import Prelude
-- | This is a `Property` but its `Result` is not accurate; in particular
-- it may return `NoChange` despite having made a change.