Commit 1271e145 authored by Lennart Kolmodin's avatar Lennart Kolmodin
Browse files

Merge pull request #96 from hvr/pr/semigroup

Define Semigroup instance for base>=4.9
parents e4daa97c f5cf5188
......@@ -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