Commit f5cf5188 authored by Herbert Valerio Riedel's avatar Herbert Valerio Riedel 🕺
Browse files

Define Semigroup instance for base>=4.9

This makes `binary` `-Wcompat`-clean for GHC 8.0
parent 91529586
......@@ -64,7 +64,11 @@ module Data.Binary.Builder.Base (
import qualified Data.ByteString as S
import qualified Data.ByteString.Lazy as L
#if MIN_VERSION_base(4,9,0)
import Data.Semigroup
#else
import Data.Monoid
#endif
import Data.Word
import Foreign
......@@ -107,10 +111,20 @@ newtype Builder = Builder {
-> IO L.ByteString
}
#if MIN_VERSION_base(4,9,0)
instance Semigroup Builder where
(<>) = append
{-# INLINE (<>) #-}
#endif
instance Monoid Builder where
mempty = empty
{-# INLINE mempty #-}
#if MIN_VERSION_base(4,9,0)
mappend = (<>)
#else
mappend = append
#endif
{-# INLINE mappend #-}
mconcat = foldr mappend mempty
{-# INLINE mconcat #-}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment