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/Dns.hs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/Propellor/Types/Dns.hs') diff --git a/src/Propellor/Types/Dns.hs b/src/Propellor/Types/Dns.hs index 513f162a..21a4860c 100644 --- a/src/Propellor/Types/Dns.hs +++ b/src/Propellor/Types/Dns.hs @@ -12,6 +12,7 @@ import Utility.Split import Data.Word import qualified Data.Map as M import qualified Data.Set as S +import qualified Data.Semigroup as Sem import Data.List import Data.Monoid import Prelude @@ -26,7 +27,7 @@ instance ConfigurableValue IPAddr where val (IPv6 addr) = addr newtype AliasesInfo = AliasesInfo (S.Set HostName) - deriving (Show, Eq, Ord, Monoid, Typeable) + deriving (Show, Eq, Ord, Sem.Semigroup, Monoid, Typeable) instance IsInfo AliasesInfo where propagateInfo _ = PropagateInfo False @@ -42,7 +43,7 @@ fromAliasesInfo (AliasesInfo s) = S.toList s -- of the containers in the host be reflected in the DNS. newtype DnsInfoPropagated = DnsInfoPropagated { fromDnsInfoPropagated :: S.Set Record } - deriving (Show, Eq, Ord, Monoid, Typeable) + deriving (Show, Eq, Ord, Sem.Semigroup, Monoid, Typeable) toDnsInfoPropagated :: S.Set Record -> DnsInfoPropagated toDnsInfoPropagated = DnsInfoPropagated @@ -55,7 +56,7 @@ instance IsInfo DnsInfoPropagated where -- the host. newtype DnsInfoUnpropagated = DnsInfoUnpropagated { fromDnsInfoUnpropagated :: S.Set Record } - deriving (Show, Eq, Ord, Monoid, Typeable) + deriving (Show, Eq, Ord, Sem.Semigroup, Monoid, Typeable) toDnsInfoUnpropagated :: S.Set Record -> DnsInfoUnpropagated toDnsInfoUnpropagated = DnsInfoUnpropagated @@ -183,15 +184,18 @@ instance IsInfo NamedConfMap where -- | Adding a Master NamedConf stanza for a particulr domain always -- overrides an existing Secondary stanza for that domain, while a -- Secondary stanza is only added when there is no existing Master stanza. -instance Monoid NamedConfMap where - mempty = NamedConfMap M.empty - mappend (NamedConfMap old) (NamedConfMap new) = NamedConfMap $ +instance Sem.Semigroup NamedConfMap where + NamedConfMap old <> NamedConfMap new = NamedConfMap $ M.unionWith combiner new old where combiner n o = case (confDnsServerType n, confDnsServerType o) of (Secondary, Master) -> o _ -> n +instance Monoid NamedConfMap where + mempty = NamedConfMap M.empty + mappend = (<>) + instance Empty NamedConfMap where isEmpty (NamedConfMap m) = isEmpty m -- cgit v1.2.3