Hello community,

here is the log from the commit of package ghc-foldl for openSUSE:Factory 
checked in at 2016-05-31 12:25:03
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-foldl (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-foldl.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-foldl"

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-foldl/ghc-foldl.changes      2016-03-16 
10:36:36.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.ghc-foldl.new/ghc-foldl.changes 2016-05-31 
12:25:03.000000000 +0200
@@ -1,0 +2,10 @@
+Mon May 30 09:50:26 UTC 2016 - [email protected]
+
+- update to 1.2.1 
+
+-------------------------------------------------------------------
+Mon Apr  4 07:38:46 UTC 2016 - [email protected]
+
+- update to 1.2.0 
+
+-------------------------------------------------------------------

Old:
----
  foldl-1.1.6.tar.gz

New:
----
  foldl-1.2.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc-foldl.spec ++++++
--- /var/tmp/diff_new_pack.JWW5OY/_old  2016-05-31 12:25:04.000000000 +0200
+++ /var/tmp/diff_new_pack.JWW5OY/_new  2016-05-31 12:25:04.000000000 +0200
@@ -18,7 +18,7 @@
 %global pkg_name foldl
 
 Name:           ghc-foldl
-Version:        1.1.6
+Version:        1.2.1
 Release:        0
 Summary:        Composable, streaming, and efficient left folds
 Group:          System/Libraries
@@ -34,6 +34,7 @@
 BuildRequires:  ghc-bytestring-devel
 BuildRequires:  ghc-comonad-devel
 BuildRequires:  ghc-containers-devel
+BuildRequires:  ghc-contravariant-devel
 BuildRequires:  ghc-mwc-random-devel
 BuildRequires:  ghc-primitive-devel
 BuildRequires:  ghc-profunctors-devel

++++++ foldl-1.1.6.tar.gz -> foldl-1.2.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/foldl-1.1.6/foldl.cabal new/foldl-1.2.1/foldl.cabal
--- old/foldl-1.1.6/foldl.cabal 2016-03-12 21:01:49.000000000 +0100
+++ new/foldl-1.2.1/foldl.cabal 2016-05-28 08:46:25.000000000 +0200
@@ -1,5 +1,5 @@
 Name: foldl
-Version: 1.1.6
+Version: 1.2.1
 Cabal-Version: >=1.8.0.2
 Build-Type: Simple
 License: BSD3
@@ -7,6 +7,7 @@
 Copyright: 2013 Gabriel Gonzalez
 Author: Gabriel Gonzalez
 Maintainer: [email protected]
+Tested-With: GHC == 7.6.3, GHC == 7.8.4, 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
@@ -26,9 +27,10 @@
         mwc-random   >= 0.13.1.0 && < 0.14,
         primitive                   < 0.7 ,
         text         >= 0.11.2.0 && < 1.3 ,
-        transformers >= 0.2.0.0  && < 0.5 ,
+        transformers >= 0.2.0.0  && < 0.6 ,
         vector       >= 0.7      && < 0.12,
         containers                  < 0.6 ,
+        contravariant               < 1.5 ,
         profunctors                 < 5.3 ,
         comonad      >= 4.0      && < 6
     Exposed-Modules:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/foldl-1.1.6/src/Control/Foldl.hs 
new/foldl-1.2.1/src/Control/Foldl.hs
--- old/foldl-1.1.6/src/Control/Foldl.hs        2016-03-12 21:01:49.000000000 
+0100
+++ new/foldl-1.2.1/src/Control/Foldl.hs        2016-05-28 08:22:59.000000000 
+0200
@@ -19,7 +19,7 @@
     Taking the sum, the sum of squares, ..., upto the sum of x^5
 
 >>> import Data.Traversable
->>> let powerSums = sequenceA [premap (^n) L.sum | n <- [1..5]]
+>>> let powerSums = sequenceA [L.premap (^n) L.sum | n <- [1..5]]
 >>> L.fold powerSums [1..10]
 [55,385,3025,25333,220825]
 
@@ -108,6 +108,8 @@
     , EndoM(..)
     , HandlerM
     , handlesM
+    , folded
+    , filtered
 
     -- * Re-exports
     -- $reexports
@@ -118,12 +120,12 @@
 
 import Control.Applicative
 import Control.Foldl.Internal (Maybe'(..), lazy, Either'(..), hush)
-import Control.Monad ((>=>))
+import Control.Monad ((<=<))
 import Control.Monad.Primitive (PrimMonad, RealWorld)
 import Control.Comonad
 import Data.Foldable (Foldable)
-import Data.Functor.Constant (Constant(Constant, getConstant))
 import Data.Functor.Identity (Identity, runIdentity)
+import Data.Functor.Contravariant (Contravariant(..))
 import Data.Monoid
 import Data.Profunctor
 import Data.Sequence ((|>))
@@ -171,7 +173,7 @@
 
 instance Functor (Fold a) where
     fmap f (Fold step begin done) = Fold step begin (f . done)
-    {-# INLINABLE fmap #-}
+    {-# INLINE fmap #-}
 
 instance Profunctor Fold where
     lmap = premap
@@ -186,14 +188,14 @@
 
 instance Applicative (Fold a) where
     pure b    = Fold (\() _ -> ()) () (\() -> b)
-    {-# INLINABLE pure #-}
+    {-# INLINE pure #-}
 
     (Fold stepL beginL doneL) <*> (Fold stepR beginR doneR) =
         let step (Pair xL xR) a = Pair (stepL xL a) (stepR xR a)
             begin = Pair beginL beginR
             done (Pair xL xR) = doneL xL (doneR xR)
         in  Fold step begin done
-    {-# INLINABLE (<*>) #-}
+    {-# INLINE (<*>) #-}
 
 instance Monoid b => Monoid (Fold a b) where
     mempty = pure mempty
@@ -556,7 +558,7 @@
 -}
 maximumBy :: (a -> a -> Ordering) -> Fold a (Maybe a)
 maximumBy cmp = _Fold1 max'
-  where 
+  where
     max' x y = case cmp x y of
         GT -> x
         _  -> y
@@ -572,7 +574,7 @@
 -}
 minimumBy :: (a -> a -> Ordering) -> Fold a (Maybe a)
 minimumBy cmp = _Fold1 min'
-  where 
+  where
     min' x y = case cmp x y of
         GT -> y
         _  -> x
@@ -797,17 +799,46 @@
     function to accept a 'Fold' or 'FoldM' using the 'purely' or 'impurely'
     combinators.
 
-    For example, the @pipes@ library implements a @foldM@ function in
+    For example, the @pipes@ library implements @fold@ and @foldM@ functions in
     @Pipes.Prelude@ with the following type:
 
-> foldM
+> Pipes.Prelude.fold
+>     :: Monad m
+>     -> (x -> a -> x) -> x -> (x -> b) -> Producer a m () -> m b
+>
+> Pipes.Prelude.foldM
 >     :: Monad m
 >     => (x -> a -> m x) -> m x -> (x -> m b) -> Producer a m () -> m b
 
-    @foldM@ is set up so that you can wrap it with 'impurely' to accept a
-    'FoldM' instead:
+    Both @fold@ and @foldM@ is set up so that you can wrap them with either
+    'purely' or 'impurely' to accept a 'Fold' or 'FoldM', respectively:
+
+> purely Pipes.Prelude.fold
+>     :: Monad m => Fold a b -> Producer a m () -> m b
+>
+> impurely Pipes.Prelude.foldM
+>     :: Monad m => FoldM m a b -> Producer a m () -> m b
+
+    Similarly the @ofoldlUnwrap@ and @ofoldMUnwrap@ functions from the
+    @monotraversable@ package are written to interoperate with this library:
 
-> impurely foldM :: Monad m => FoldM m a b -> Producer a m () -> m b
+> ofoldlUnwrap
+>     :: MonoFoldable mono
+>     => (x -> Element mono -> x) -> x -> (x -> b) -> mono -> b
+>
+> ofoldMUnwrap
+>     :: (Monad m, MonoFoldable mono)
+>     => (x -> Element mono -> m x) -> m x -> (x -> m b) -> mono -> m b
+
+    You can wrap these to accept 'Fold' or 'FoldM', too:
+
+> purely ofoldlUnwrap
+>     :: MonoFoldable mono
+>     => Fold (Element mono) b -> mono -> b
+>
+> impurely ofoldMUnwrap
+>     :: MonoFoldable mono
+>     => FoldM m (Element mono) b -> mono -> m b
 -}
 
 -- | Upgrade a fold to accept the 'Fold' type
@@ -943,7 +974,7 @@
     Any lens, traversal, or prism will type-check as a `Handler`
 -}
 type Handler a b =
-    forall x . (b -> Constant (Endo x) b) -> a -> Constant (Endo x) a
+    forall x . (b -> Const (Dual (Endo x)) b) -> a -> Const (Dual (Endo x)) a
 
 {-| @(handles t folder)@ transforms the input of a `Fold` using a lens,
     traversal, or prism:
@@ -960,7 +991,7 @@
 42
 
 >>> fold (handles (filtered even) sum) [1..10]
-42
+30
 
 >>> fold (handles _2 mconcat) [(1,"Hello "),(2,"World"),(3,"!")]
 "Hello World!"
@@ -976,26 +1007,26 @@
 handles :: Handler a b -> Fold b r -> Fold a r
 handles k (Fold step begin done) = Fold step' begin done
   where
-    step' = flip (appEndo . getConstant . k (Constant . Endo . flip step))
+    step' = flip (appEndo . getDual . getConst . k (Const . Dual . Endo . flip 
step))
 {-# INLINABLE handles #-}
 
 {-|
 > instance Monad m => Monoid (EndoM m a) where
 >     mempty = EndoM return
->     mappend (EndoM f) (EndoM g) = EndoM (f >=> g)
+>     mappend (EndoM f) (EndoM g) = EndoM (f <=< g)
 -}
 newtype EndoM m a = EndoM { appEndoM :: a -> m a }
 
 instance Monad m => Monoid (EndoM m a) where
     mempty = EndoM return
-    mappend (EndoM f) (EndoM g) = EndoM (f >=> g)
+    mappend (EndoM f) (EndoM g) = EndoM (f <=< g)
 
 {-| A Handler for the upstream input of `FoldM`
 
     Any lens, traversal, or prism will type-check as a `HandlerM`
 -}
 type HandlerM m a b =
-    forall x . (b -> Constant (EndoM m x) b) -> a -> Constant (EndoM m x) a
+    forall x . (b -> Const (Dual (EndoM m x)) b) -> a -> Const (Dual (EndoM m 
x)) a
 
 {-| @(handlesM t folder)@ transforms the input of a `FoldM` using a lens,
     traversal, or prism:
@@ -1018,9 +1049,37 @@
 handlesM :: Monad m => HandlerM m a b -> FoldM m b r -> FoldM m a r
 handlesM k (FoldM step begin done) = FoldM step' begin done
   where
-    step' = flip (appEndoM . getConstant . k (Constant . EndoM . flip step))
+    step' = flip (appEndoM . getDual . getConst . k (Const . Dual . EndoM . 
flip step))
 {-# INLINABLE handlesM #-}
 
+{-|
+> folded :: Foldable t => Fold (t a) a
+>
+> handles folded :: Foldable t => Fold a r -> Fold (t a) r
+-}
+folded
+    :: (Contravariant f, Applicative f, Foldable t)
+    => (a -> f a) -> (t a -> f (t a))
+folded k ts = contramap (\_ -> ()) (F.traverse_ k ts)
+
+{-|
+>>> fold (handles (filtered even) sum) [1..10]
+30
+
+>>> foldM (handlesM (filtered even) (mapM_ print)) [1..10]
+2
+4
+6
+8
+10
+
+-}
+filtered :: Monoid m => (a -> Bool) -> (a -> m) -> a -> m
+filtered p k x
+    | p x = k x
+    | otherwise = mempty
+{-# INLINABLE filtered #-}
+
 {- $reexports
     @Control.Monad.Primitive@ re-exports the 'PrimMonad' type class
 


Reply via email to