summaryrefslogtreecommitdiff
path: root/src/Propellor/Types/Info.hs
diff options
context:
space:
mode:
authorJoey Hess2018-04-23 13:20:13 -0400
committerJoey Hess2018-04-23 13:20:13 -0400
commit9228bda32f0a3f6d52e7cc5eb444376e7b024d8c (patch)
treee3ada017b0f625db8b39a2212ab82c8e32a62b7c /src/Propellor/Types/Info.hs
parent5ecbec11127449fefe4812fd6b374801ce8499c1 (diff)
semigroup monoid change fallout; drop ghc 7 support
Fix build with ghc 8.4, which broke due to the Semigroup Monoid change. See https://prime.haskell.org/wiki/Libraries/Proposals/SemigroupMonoid Dropped support for building propellor with ghc 7 (as in debian oldstable), to avoid needing to depend on the semigroups transitional package, but also because it's just too old to be worth supporting. If we indeed drop ghc 7 support entirely, some code to support "jessie" can be removed; concurrent-output can be de-embedded, and the Singletons code can be simplified. This commit was sponsored by Jack Hill on Patreon.
Diffstat (limited to 'src/Propellor/Types/Info.hs')
-rw-r--r--src/Propellor/Types/Info.hs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/Propellor/Types/Info.hs b/src/Propellor/Types/Info.hs
index 06c45ed2..2ab6da7b 100644
--- a/src/Propellor/Types/Info.hs
+++ b/src/Propellor/Types/Info.hs
@@ -17,6 +17,7 @@ module Propellor.Types.Info (
import Data.Dynamic
import Data.Maybe
import Data.Monoid
+import qualified Data.Semigroup as Sem
import qualified Data.Typeable as T
import Prelude
@@ -25,7 +26,7 @@ import Prelude
-- Many different types of data can be contained in the same Info value
-- at the same time. See `toInfo` and `fromInfo`.
newtype Info = Info [InfoEntry]
- deriving (Monoid, Show)
+ deriving (Sem.Semigroup, Monoid, Show)
data InfoEntry where
InfoEntry :: (IsInfo v, Typeable v) => v -> InfoEntry
@@ -80,10 +81,13 @@ mapInfo f (Info l) = Info (map go l)
data InfoVal v = NoInfoVal | InfoVal v
deriving (Typeable, Show)
+instance Sem.Semigroup (InfoVal v) where
+ _ <> v@(InfoVal _) = v
+ v <> NoInfoVal = v
+
instance Monoid (InfoVal v) where
mempty = NoInfoVal
- mappend _ v@(InfoVal _) = v
- mappend v NoInfoVal = v
+ mappend = (<>)
instance (Typeable v, Show v) => IsInfo (InfoVal v) where
propagateInfo _ = PropagateInfo False