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/Core.hs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/Propellor/Types/Core.hs') diff --git a/src/Propellor/Types/Core.hs b/src/Propellor/Types/Core.hs index a805f561..cd3e09c5 100644 --- a/src/Propellor/Types/Core.hs +++ b/src/Propellor/Types/Core.hs @@ -10,6 +10,7 @@ import Propellor.Types.OS import Propellor.Types.Result import Data.Monoid +import qualified Data.Semigroup as Sem import "mtl" Control.Monad.RWS.Strict import Control.Monad.Catch import Control.Applicative @@ -50,15 +51,18 @@ instance LiftPropellor IO where -- | When two actions are appended together, the second action -- is only run if the first action does not fail. -instance Monoid (Propellor Result) where - mempty = return NoChange - mappend x y = do +instance Sem.Semigroup (Propellor Result) where + x <> y = do rx <- x case rx of FailedChange -> return FailedChange _ -> do ry <- y return (rx <> ry) + +instance Monoid (Propellor Result) where + mempty = return NoChange + mappend = (<>) -- | An action that Propellor runs at the end, after trying to satisfy all -- properties. It's passed the combined Result of the entire Propellor run. -- cgit v1.2.3