diff --git a/src/Database/PostgreSQL/Protocol/Store/Encode.hs b/src/Database/PostgreSQL/Protocol/Store/Encode.hs index c5fd321..e3b2572 100644 --- a/src/Database/PostgreSQL/Protocol/Store/Encode.hs +++ b/src/Database/PostgreSQL/Protocol/Store/Encode.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} module Database.PostgreSQL.Protocol.Store.Encode ( Encode , getEncodeLen @@ -26,15 +27,21 @@ import Data.ByteString.Internal (toForeignPtr) import Data.Store.Core (Poke(..), unsafeEncodeWith, pokeStatePtr, pokeFromForeignPtr) +import qualified Data.Semigroup as Sem + data Encode = Encode {-# UNPACK #-} !Int !(Poke ()) -instance Semigroup Encode where +instance Sem.Semigroup Encode where {-# INLINE (<>) #-} (Encode len1 f1) <> (Encode len2 f2) = Encode (len1 + len2) (f1 *> f2) instance Monoid Encode where {-# INLINE mempty #-} mempty = Encode 0 . Poke $ \_ offset -> pure (offset, ()) +#if !(MIN_VERSION_base(4,11,0)) + mappend = (Sem.<>) +#endif + instance Show Encode where show (Encode len _) = "Encode instance of length " ++ show len diff --git a/stack-ghc8.2.2.yaml b/stack-ghc8.2.2.yaml new file mode 100644 index 0000000..9cd2430 --- /dev/null +++ b/stack-ghc8.2.2.yaml @@ -0,0 +1,22 @@ +# This file was automatically generated by 'stack init' +# +resolver: lts-11.22 + +packages: +- '.' +# Dependency packages to be pulled from upstream that are not in the resolver +# (e.g., acme-missiles-0.3) +extra-deps: + - socket-0.8.2.0 + - socket-unix-0.2.0.0 +# <<<<<<< HEAD +# ======= +# - store-core-0.3 +# - QuickCheck-2.9.2 +# >>>>>>> QuickCheck tests for existing codecs + +# Override default flag values for local packages and extra-deps +flags: {} + +# Extra package databases containing global packages +extra-package-dbs: [] diff --git a/stack-ghc8.4.4.yaml b/stack-ghc8.4.4.yaml new file mode 100644 index 0000000..02aa3cd --- /dev/null +++ b/stack-ghc8.4.4.yaml @@ -0,0 +1,22 @@ +# This file was automatically generated by 'stack init' +# +resolver: lts-12.26 + +packages: +- '.' +# Dependency packages to be pulled from upstream that are not in the resolver +# (e.g., acme-missiles-0.3) +extra-deps: + - socket-0.8.2.0 + - socket-unix-0.2.0.0 +# <<<<<<< HEAD +# ======= +# - store-core-0.3 +# - QuickCheck-2.9.2 +# >>>>>>> QuickCheck tests for existing codecs + +# Override default flag values for local packages and extra-deps +flags: {} + +# Extra package databases containing global packages +extra-package-dbs: []