Skip to content

Commit f64e1d1

Browse files
strakeIagoAbal
authored andcommitted
Fix compatibility with base 4.11 due to SMP
In base 4.11 Semigroup became a superclass of Monoid. Reviewed-by: Iago Abal <mail@iagoabal.eu>
1 parent c422785 commit f64e1d1

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/Z3/Opts.hs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{-# LANGUAGE CPP #-}
12

23
-- |
34
-- Module : Z3.Opts
@@ -52,15 +53,28 @@ import Data.Fixed ( Fixed )
5253
import qualified Data.Fixed as Fixed
5354
import Data.Monoid ( Monoid(..) )
5455

56+
#if MIN_VERSION_base(4,9,0)
57+
import Data.Semigroup ( Semigroup (..) )
58+
#endif
59+
5560
---------------------------------------------------------------------
5661
-- Configuration
5762

5863
-- | Z3 configuration.
5964
newtype Opts = Opts [Opt]
6065

66+
#if MIN_VERSION_base(4,9,0)
67+
instance Semigroup Opts where
68+
Opts ps1 <> Opts ps2 = Opts (ps1 ++ ps2)
69+
#endif
70+
6171
instance Monoid Opts where
6272
mempty = Opts []
63-
mappend (Opts ps1) (Opts ps2) = Opts (ps1++ps2)
73+
#if MIN_VERSION_base(4,9,0)
74+
mappend = (<>)
75+
#else
76+
Opts ps1 `mappend` Opts ps2 = Opts (ps1 ++ ps2)
77+
#endif
6478

6579
singleton :: Opt -> Opts
6680
singleton o = Opts [o]

0 commit comments

Comments
 (0)