Relax Monoid constraint to Semigroup for the Monoid Chunk instance (#331)

* Relax Monoid constraint to Semigroup for the Monoid Chunk instance

* Bump lower bound of ansi-wl-pprint to be compatible with previous Monoid ->
Semigroup change

* Removed 7.0 and 7.2 from supported GHC versions
This commit is contained in:
Ben Selfridge 2019-02-27 15:52:50 -08:00 committed by Huw Campbell
parent 25dab7dfec
commit 72b6e4a52c
3 changed files with 7 additions and 8 deletions

View File

@ -1,6 +1,4 @@
env:
- GHCVER=7.0.4
- GHCVER=7.2.2
- GHCVER=7.4.2
- GHCVER=7.6.3
- GHCVER=7.8.4

View File

@ -16,6 +16,7 @@ module Options.Applicative.Help.Chunk
import Control.Applicative
import Control.Monad
import Data.List.NonEmpty ( NonEmpty(..) )
import Data.Maybe
import Data.Semigroup
import Prelude
@ -45,10 +46,10 @@ instance Monad Chunk where
return = pure
m >>= f = Chunk $ unChunk m >>= unChunk . f
instance Monoid a => Semigroup (Chunk a) where
(<>) = chunked mappend
instance Semigroup a => Semigroup (Chunk a) where
(<>) = chunked (<>)
instance Monoid a => Monoid (Chunk a) where
instance Semigroup a => Monoid (Chunk a) where
mempty = Chunk Nothing
mappend = (<>)
@ -69,9 +70,9 @@ chunked f (Chunk (Just x)) (Chunk (Just y)) = Chunk (Just (f x y))
--
-- > isEmpty . listToChunk = null
-- > listToChunk = mconcat . fmap pure
listToChunk :: Monoid a => [a] -> Chunk a
listToChunk :: Semigroup a => [a] -> Chunk a
listToChunk [] = mempty
listToChunk xs = pure (mconcat xs)
listToChunk (x:xs) = pure (sconcat (x :| xs))
-- | Part of a constrained comonad instance.
--

View File

@ -73,7 +73,7 @@ library
, transformers >= 0.2 && < 0.6
, transformers-compat >= 0.3 && < 0.7
, process >= 1.0 && < 1.7
, ansi-wl-pprint >= 0.6.6 && < 0.7
, ansi-wl-pprint >= 0.6.8 && < 0.7
if !impl(ghc >= 8)
build-depends: semigroups >= 0.10 && < 0.19