From 9228bda32f0a3f6d52e7cc5eb444376e7b024d8c Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 23 Apr 2018 13:20:13 -0400 Subject: 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. --- src/Propellor/Types/Chroot.hs | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'src/Propellor/Types/Chroot.hs') diff --git a/src/Propellor/Types/Chroot.hs b/src/Propellor/Types/Chroot.hs index da912120..b27203e5 100644 --- a/src/Propellor/Types/Chroot.hs +++ b/src/Propellor/Types/Chroot.hs @@ -7,6 +7,7 @@ import Propellor.Types.Empty import Propellor.Types.Info import Data.Monoid +import qualified Data.Semigroup as Sem import qualified Data.Map as M data ChrootInfo = ChrootInfo @@ -18,13 +19,16 @@ data ChrootInfo = ChrootInfo instance IsInfo ChrootInfo where propagateInfo _ = PropagateInfo False -instance Monoid ChrootInfo where - mempty = ChrootInfo mempty mempty - mappend old new = ChrootInfo +instance Sem.Semigroup ChrootInfo where + old <> new = ChrootInfo { _chroots = M.union (_chroots old) (_chroots new) , _chrootCfg = _chrootCfg old <> _chrootCfg new } +instance Monoid ChrootInfo where + mempty = ChrootInfo mempty mempty + mappend = (<>) + instance Empty ChrootInfo where isEmpty i = and [ isEmpty (_chroots i) @@ -36,12 +40,15 @@ data ChrootCfg | SystemdNspawnCfg [(String, Bool)] deriving (Show, Eq) +instance Sem.Semigroup ChrootCfg where + v <> NoChrootCfg = v + NoChrootCfg <> v = v + SystemdNspawnCfg l1 <> SystemdNspawnCfg l2 = + SystemdNspawnCfg (l1 <> l2) + instance Monoid ChrootCfg where mempty = NoChrootCfg - mappend v NoChrootCfg = v - mappend NoChrootCfg v = v - mappend (SystemdNspawnCfg l1) (SystemdNspawnCfg l2) = - SystemdNspawnCfg (l1 <> l2) + mappend = (<>) instance Empty ChrootCfg where isEmpty c= c == NoChrootCfg -- cgit v1.2.3