summaryrefslogtreecommitdiff
path: root/src/Propellor/Types/Result.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/Result.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/Result.hs')
-rw-r--r--src/Propellor/Types/Result.hs15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/Propellor/Types/Result.hs b/src/Propellor/Types/Result.hs
index 5209094b..f552b29b 100644
--- a/src/Propellor/Types/Result.hs
+++ b/src/Propellor/Types/Result.hs
@@ -1,6 +1,7 @@
module Propellor.Types.Result where
import System.Console.ANSI
+import qualified Data.Semigroup as Sem
import Data.Monoid
import Prelude
@@ -8,14 +9,16 @@ import Prelude
data Result = NoChange | MadeChange | FailedChange
deriving (Read, Show, Eq)
+instance Sem.Semigroup Result where
+ FailedChange <> _ = FailedChange
+ _ <> FailedChange = FailedChange
+ MadeChange <> _ = MadeChange
+ _ <> MadeChange = MadeChange
+ NoChange <> NoChange = NoChange
+
instance Monoid Result where
mempty = NoChange
-
- mappend FailedChange _ = FailedChange
- mappend _ FailedChange = FailedChange
- mappend MadeChange _ = MadeChange
- mappend _ MadeChange = MadeChange
- mappend NoChange NoChange = NoChange
+ mappend = (<>)
class ToResult t where
toResult :: t -> Result