packages feed

foldl 1.4.1 → 1.4.2

raw patch · 4 files changed

+24/−5 lines, 4 filesdep +semigroupoidsdep ~contravariantdep ~profunctorsPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies added: semigroupoids

Dependency ranges changed: contravariant, profunctors

API changes (from Hackage documentation)

- Control.Foldl: instance (Data.Semigroup.Semigroup b, GHC.Base.Monad m) => Data.Semigroup.Semigroup (Control.Foldl.FoldM m a b)
- Control.Foldl: instance Data.Semigroup.Semigroup b => Data.Semigroup.Semigroup (Control.Foldl.Fold a b)
- Control.Foldl: instance GHC.Base.Monad m => Data.Semigroup.Semigroup (Control.Foldl.EndoM m a)
- Control.Scanl: instance (GHC.Base.Monad m, Data.Semigroup.Semigroup b) => Data.Semigroup.Semigroup (Control.Scanl.ScanM m a b)
- Control.Scanl: instance Data.Semigroup.Semigroup b => Data.Semigroup.Semigroup (Control.Scanl.Scan a b)
+ Control.Foldl: class Foldable (t :: * -> *)
+ Control.Foldl: class Monad m => PrimMonad (m :: * -> *)
+ Control.Foldl: class MVector Mutable v a => Vector (v :: * -> *) a
+ Control.Foldl: data RealWorld
+ Control.Foldl: instance (GHC.Base.Semigroup b, GHC.Base.Monad m) => GHC.Base.Semigroup (Control.Foldl.FoldM m a b)
+ Control.Foldl: instance Data.Semigroupoid.Semigroupoid Control.Foldl.Fold
+ Control.Foldl: instance GHC.Base.Monad m => GHC.Base.Semigroup (Control.Foldl.EndoM m a)
+ Control.Foldl: instance GHC.Base.Semigroup b => GHC.Base.Semigroup (Control.Foldl.Fold a b)
+ Control.Foldl.ByteString: class Foldable (t :: * -> *)
+ Control.Foldl.ByteString: data ByteString
+ Control.Foldl.ByteString: data Fold a b
+ Control.Foldl.ByteString: data FoldM m a b
+ Control.Foldl.ByteString: data Word8
+ Control.Foldl.Text: class Foldable (t :: * -> *)
+ Control.Foldl.Text: data Fold a b
+ Control.Foldl.Text: data FoldM m a b
+ Control.Foldl.Text: data Text
+ Control.Scanl: instance (GHC.Base.Monad m, GHC.Base.Semigroup b) => GHC.Base.Semigroup (Control.Scanl.ScanM m a b)
+ Control.Scanl: instance GHC.Base.Semigroup b => GHC.Base.Semigroup (Control.Scanl.Scan a b)
- Control.Foldl: EndoM :: (a -> m a) -> EndoM m a
+ Control.Foldl: EndoM :: a -> m a -> EndoM m a

Files

CHANGELOG.md view
@@ -1,3 +1,8 @@+1.4.2++* Add `Semigroupoid` instance for `Fold`+* Increase upper bound on `contravariant` and `profunctors`+ 1.4.1  * Add `Control.Scanl`
README.md view
@@ -1,4 +1,4 @@-# `foldl` v1.4.1+# `foldl` v1.4.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.4.1+Version: 1.4.2 Cabal-Version: >=1.8.0.2 Build-Type: Simple License: BSD3@@ -7,7 +7,6 @@ Copyright: 2013 Gabriel Gonzalez Author: Gabriel Gonzalez Maintainer: Gabriel439@gmail.com-Tested-With: GHC == 7.10.2, GHC == 8.0.1 Bug-Reports: https://github.com/Gabriel439/Haskell-Foldl-Library/issues Synopsis: Composable, streaming, and efficient left folds Description: This library provides strict left folds that stream in constant@@ -35,9 +34,10 @@         containers   >= 0.5.0.0  && < 0.6 ,         unordered-containers        < 0.3 ,         hashable                    < 1.3 ,-        contravariant               < 1.5 ,+        contravariant               < 1.6 ,         semigroups   >= 0.17     && < 1.19,-        profunctors                 < 5.3 ,+        profunctors                 < 5.4 ,+        semigroupoids >= 1.0     && < 5.4 ,         comonad      >= 4.0      && < 6   ,         vector-builder              < 0.4     Exposed-Modules:
src/Control/Foldl.hs view
@@ -148,6 +148,7 @@ import Data.Maybe (fromMaybe) import Data.Monoid hiding ((<>)) import Data.Semigroup (Semigroup(..))+import Data.Semigroupoid (Semigroupoid) import Data.Profunctor import Data.Sequence ((|>)) import Data.Vector.Generic (Vector, Mutable)@@ -185,6 +186,7 @@ import qualified Data.Vector.Generic.Mutable as M import qualified VectorBuilder.Builder import qualified VectorBuilder.Vector+import qualified Data.Semigroupoid  {-| Efficient representation of a left fold that preserves the fold's step     function, initial accumulator, and extraction function@@ -232,6 +234,18 @@ instance Semigroup b => Semigroup (Fold a b) where     (<>) = liftA2 (<>)     {-# INLINE (<>) #-}++instance Semigroupoid Fold where+    o (Fold step1 begin1 done1) (Fold step2 begin2 done2) = Fold+        step+        (Pair begin1 begin2)+        (\(Pair x _) -> done1 x)+      where+        step (Pair c1 c2) a =+            let c2' = step2 c2 a+                c1' = step1 c1 (done2 c2')+            in  Pair c1' c2'+    {-# INLINE o #-}  instance Monoid b => Monoid (Fold a b) where     mempty = pure mempty