servant 0.16.0.1 → 0.16.1
raw patch · 3 files changed
+46/−3 lines, 3 filesdep ~http-api-dataPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: http-api-data
API changes (from Hackage documentation)
+ Servant.Types.SourceT: instance GHC.Base.Functor m => GHC.Base.Monoid (Servant.Types.SourceT.SourceT m a)
+ Servant.Types.SourceT: instance GHC.Base.Functor m => GHC.Base.Monoid (Servant.Types.SourceT.StepT m a)
+ Servant.Types.SourceT: instance GHC.Base.Functor m => GHC.Base.Semigroup (Servant.Types.SourceT.SourceT m a)
+ Servant.Types.SourceT: instance GHC.Base.Functor m => GHC.Base.Semigroup (Servant.Types.SourceT.StepT m a)
Files
- CHANGELOG.md +10/−0
- servant.cabal +4/−3
- src/Servant/Types/SourceT.hs +32/−0
CHANGELOG.md view
@@ -1,5 +1,15 @@ [The latest version of this document is on GitHub.](https://github.com/haskell-servant/servant/blob/master/servant/CHANGELOG.md) +0.16.1+------++* Add `Semigroup` and `Monoid` `SourceT` instances+ [#1158](https://github.com/haskell-servant/servant/pull/1158)+ [#1159](https://github.com/haskell-servant/servant/pull/1159)+* Use `http-api-data-0.4.1`+ [#1181](https://github.com/haskell-servant/servant/pull/1181)+* Allow newer dependencies+ 0.16.0.1 --------
servant.cabal view
@@ -1,6 +1,6 @@ cabal-version: >=1.10 name: servant-version: 0.16.0.1+version: 0.16.1 synopsis: A family of combinators for defining webservices APIs category: Servant, Web@@ -24,7 +24,8 @@ GHC ==8.0.2 || ==8.2.2 || ==8.4.4- || ==8.6.4+ || ==8.6.5+ || ==8.8.1 extra-source-files: CHANGELOG.md@@ -98,7 +99,7 @@ -- We depend (heavily) on the API of these packages: -- i.e. re-export, or allow using without direct dependency build-depends:- http-api-data >= 0.4 && < 0.4.1+ http-api-data >= 0.4.1 && < 0.4.2 , singleton-bool >= 0.1.4 && < 0.1.5 -- Other dependencies: Lower bound around what is in the latest Stackage LTS.
src/Servant/Types/SourceT.hs view
@@ -89,6 +89,21 @@ hoist f (SourceT m) = SourceT $ \k -> k $ Effect $ f $ fmap (hoist f) $ m return +-- | >>> source "xy" <> source "z" :: SourceT Identity Char+-- fromStepT (Effect (Identity (Yield 'x' (Yield 'y' (Yield 'z' Stop)))))+--+instance Functor m => Semigroup (SourceT m a) where+ SourceT withL <> SourceT withR = SourceT $ \ret ->+ withL $ \l ->+ withR $ \r ->+ ret $ l <> r++-- | >>> mempty :: SourceT Maybe Int+-- fromStepT (Effect (Just Stop))+instance Functor m => Monoid (SourceT m a) where+ mempty = fromStepT mempty+ mappend = (<>)+ -- | Doesn't generate 'Error' constructors. 'SourceT' doesn't shrink. instance (QC.Arbitrary a, Monad m) => QC.Arbitrary (SourceT m a) where arbitrary = fromStepT <$> QC.arbitrary@@ -149,6 +164,23 @@ go (Skip s) = Skip (go s) go (Yield x s) = Yield x (go s) go (Effect ms) = Effect (f (fmap go ms))++instance Functor m => Semigroup (StepT m a) where+ Stop <> r = r+ Error err <> _ = Error err+ Skip s <> r = Skip (s <> r)+ Yield x s <> r = Yield x (s <> r)+ Effect ms <> r = Effect ((<> r) <$> ms)++-- | >>> mempty :: StepT [] Int+-- Stop+--+-- >>> mempty :: StepT Identity Int+-- Stop+--+instance Functor m => Monoid (StepT m a) where+ mempty = Stop+ mappend = (<>) -- | Doesn't generate 'Error' constructors. instance (QC.Arbitrary a, Monad m) => QC.Arbitrary (StepT m a) where