foldl 1.3.1 → 1.3.2
raw patch · 4 files changed
+26/−7 lines, 4 filesdep +semigroupsdep ~basePVP ok
version bump matches the API change (PVP)
Dependencies added: semigroups
Dependency ranges changed: base
API changes (from Hackage documentation)
+ Control.Foldl: instance (GHC.Base.Monoid b, GHC.Base.Monad m) => Data.Semigroup.Semigroup (Control.Foldl.FoldM m a b)
+ Control.Foldl: instance GHC.Base.Monad m => Data.Semigroup.Semigroup (Control.Foldl.EndoM m a)
+ Control.Foldl: instance GHC.Base.Monoid b => Data.Semigroup.Semigroup (Control.Foldl.Fold a b)
Files
- CHANGELOG.md +6/−1
- README.md +1/−1
- foldl.cabal +2/−1
- src/Control/Foldl.hs +17/−4
CHANGELOG.md view
@@ -1,6 +1,11 @@+1.3.2++* Compatibility with `Semigroup` becoming a super-class of `Monoid`+* Fix `asin` for `Fold`+ 1.3.1 -* BUG FIX: `asin` now correctly delegates to `fmap asin` and not `fmap sin`+* Fix `asin` for `FoldM` 1.3.0
README.md view
@@ -1,4 +1,4 @@-# `foldl` v1.3.1+# `foldl` v1.3.2 Use this `foldl` library when you want to compute multiple folds over a collection in one pass over the data without space leaks.
foldl.cabal view
@@ -1,5 +1,5 @@ Name: foldl-Version: 1.3.1+Version: 1.3.2 Cabal-Version: >=1.8.0.2 Build-Type: Simple License: BSD3@@ -36,6 +36,7 @@ unordered-containers < 0.3 , hashable < 1.3 , contravariant < 1.5 ,+ semigroups >= 0.17 && < 1.19, profunctors < 5.3 , comonad >= 4.0 && < 6 , vector-builder < 0.4
src/Control/Foldl.hs view
@@ -143,7 +143,8 @@ import Data.Foldable (Foldable) import Data.Functor.Identity (Identity, runIdentity) import Data.Functor.Contravariant (Contravariant(..))-import Data.Monoid+import Data.Monoid hiding ((<>))+import Data.Semigroup (Semigroup(..)) import Data.Profunctor import Data.Sequence ((|>)) import Data.Vector.Generic (Vector, Mutable)@@ -222,11 +223,15 @@ in Fold step begin done {-# INLINE (<*>) #-} +instance Monoid b => Semigroup (Fold a b) where+ (<>) = liftA2 mappend+ {-# INLINE (<>) #-}+ instance Monoid b => Monoid (Fold a b) where mempty = pure mempty {-# INLINE mempty #-} - mappend = liftA2 mappend+ mappend = (<>) {-# INLINE mappend #-} instance Num b => Num (Fold a b) where@@ -283,7 +288,7 @@ cos = fmap cos {-# INLINE cos #-} - asin = fmap sin+ asin = fmap asin {-# INLINE asin #-} atan = fmap atan@@ -357,6 +362,10 @@ rmap = fmap lmap = premapM +instance (Monoid b, Monad m) => Semigroup (FoldM m a b) where+ (<>) = liftA2 mappend+ {-# INLINE (<>) #-}+ instance (Monoid b, Monad m) => Monoid (FoldM m a b) where mempty = pure mempty {-# INLINE mempty #-}@@ -1156,11 +1165,15 @@ -} newtype EndoM m a = EndoM { appEndoM :: a -> m a } +instance Monad m => Semigroup (EndoM m a) where+ (EndoM f) <> (EndoM g) = EndoM (f <=< g)+ {-# INLINE (<>) #-}+ instance Monad m => Monoid (EndoM m a) where mempty = EndoM return {-# INLINE mempty #-} - mappend (EndoM f) (EndoM g) = EndoM (f <=< g)+ mappend = (<>) {-# INLINE mappend #-} {-| A Handler for the upstream input of `FoldM`