From 5e99acdbf0bd7db0929d0bb2c27d6ca5b5144d4c Mon Sep 17 00:00:00 2001 From: Kostiantyn Rybnikov Date: Wed, 17 Jan 2018 00:20:22 +0200 Subject: [PATCH 1/3] Add a Semigroup instance --- Database/MySQL/Base/Types.hsc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Database/MySQL/Base/Types.hsc b/Database/MySQL/Base/Types.hsc index a1c2821..f618d1a 100644 --- a/Database/MySQL/Base/Types.hsc +++ b/Database/MySQL/Base/Types.hsc @@ -54,6 +54,7 @@ import Data.ByteString.Internal (create, memcpy) import Data.List (intercalate) import Data.Maybe (catMaybes) import Data.Monoid (Monoid(..)) +import Data.Semigroup (Semigroup(..)) import Data.Typeable (Typeable) import Data.Word (Word, Word8) import Foreign.C.Types (CChar, CInt, CUInt, CULong) @@ -171,10 +172,14 @@ instance Show FieldFlags where type FieldFlag = FieldFlags +instance Semigroup FieldFlags where + (<>) (FieldFlags a) (FieldFlags b) = FieldFlags (a .|. b) + {-# INLINE (<>) #-} + instance Monoid FieldFlags where mempty = FieldFlags 0 {-# INLINE mempty #-} - mappend (FieldFlags a) (FieldFlags b) = FieldFlags (a .|. b) + mappend = (<>) {-# INLINE mappend #-} flagNotNull, flagPrimaryKey, flagUniqueKey, flagMultipleKey :: FieldFlag From 32e5577546524978402e8e6bebe6bb7c6b227bd6 Mon Sep 17 00:00:00 2001 From: Kostiantyn Rybnikov Date: Wed, 17 Jan 2018 00:20:30 +0200 Subject: [PATCH 2/3] Add an lts-10.3 setup in Travis --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 279d2bc..f0b1a57 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,6 +24,8 @@ matrix: compiler: ": # lts-6" - env: ARGS="--resolver lts-7" compiler: ": # lts-7" + - env: ARGS="--resolver lts-10" + compiler: ": # lts-10" - env: ARGS="--resolver nightly" compiler: ": # nightly" - env: ARGS="--resolver lts" From 96d66a05f0b6ac4a4d14e69b8e304aa38fc24e87 Mon Sep 17 00:00:00 2001 From: Kostiantyn Rybnikov Date: Thu, 18 Jan 2018 12:32:23 +0200 Subject: [PATCH 3/3] Conditionally depend upon semigroups --- mysql.cabal | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mysql.cabal b/mysql.cabal index da0fb80..057d86a 100644 --- a/mysql.cabal +++ b/mysql.cabal @@ -51,6 +51,9 @@ library base < 5, bytestring >= 0.9 && < 1.0, containers + if !impl(ghc >= 8.0) + build-depends: + semigroups >= 0.11 && < 0.19 ghc-options: -Wall if impl(ghc >= 6.8)