commit ghc-foldl for openSUSE:Factory
Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ghc-foldl for openSUSE:Factory checked in at 2024-12-29 11:56:31 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-foldl (Old) and /work/SRC/openSUSE:Factory/.ghc-foldl.new.1881 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "ghc-foldl" Sun Dec 29 11:56:31 2024 rev:30 rq:1233618 version:1.4.18 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-foldl/ghc-foldl.changes 2024-09-06 17:19:13.537588177 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-foldl.new.1881/ghc-foldl.changes 2024-12-29 11:56:47.064535066 +0100 @@ -1,0 +2,9 @@ +Fri Dec 20 05:14:50 UTC 2024 - Peter Simons <psimons@suse.com> + +- Update foldl to version 1.4.18. + Upstream has edited the change log file since the last release in + a non-trivial way, i.e. they did more than just add a new entry + at the top. You can review the file at: + http://hackage.haskell.org/package/foldl-1.4.18/src/CHANGELOG.md + +------------------------------------------------------------------- Old: ---- foldl-1.4.17.tar.gz New: ---- foldl-1.4.18.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-foldl.spec ++++++ --- /var/tmp/diff_new_pack.DQMmDM/_old 2024-12-29 11:56:47.772564100 +0100 +++ /var/tmp/diff_new_pack.DQMmDM/_new 2024-12-29 11:56:47.772564100 +0100 @@ -20,7 +20,7 @@ %global pkgver %{pkg_name}-%{version} %bcond_with tests Name: ghc-%{pkg_name} -Version: 1.4.17 +Version: 1.4.18 Release: 0 Summary: Composable, streaming, and efficient left folds License: BSD-3-Clause ++++++ foldl-1.4.17.tar.gz -> foldl-1.4.18.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/foldl-1.4.17/CHANGELOG.md new/foldl-1.4.18/CHANGELOG.md --- old/foldl-1.4.17/CHANGELOG.md 2001-09-09 03:46:40.000000000 +0200 +++ new/foldl-1.4.18/CHANGELOG.md 2001-09-09 03:46:40.000000000 +0200 @@ -1,7 +1,15 @@ +1.4.18 + +- Add [`lifts`](https://github.com/Gabriella439/foldl/pull/214) +- Add [`nest`](https://github.com/Gabriella439/foldl/pull/215) for `Fold1` +- Add [`Choice`, `Closed`, `Cosieve`, `Extend`, `Semigroupoid`, `Category`, `Strong`, `Arrow` and `ArrowChoice`](https://github.com/Gabriella439/foldl/pull/215) instances for `Fold1` +- Add [`Closed`](https://github.com/Gabriella439/foldl/pull/215) instance for `Fold` +- [Define `stimes` from `EndoM`'s Semigroup instance for 0](https://github.com/Gabriella439/foldl/pull/217) + 1.4.17 -- Add [Fold1 utilities](): `purely`, `purely_`, `premap`, `handles`, `foldOver`, `folded1` -- Add pattern synonym `Fold1_` that makes the initial, step and extraction functions explicit. +- Add [Fold1 utilities](https://github.com/Gabriella439/foldl/pull/212): `purely`, `purely_`, `premap`, `handles`, `foldOver`, `folded1` +- Add pattern synonym [`Fold1_`](https://github.com/Gabriella439/foldl/pull/212) that makes the initial, step and extraction functions explicit. 1.4.16 @@ -15,7 +23,7 @@ - Add [`Control.Foldl.NonEmpty.nonEmpty`](https://github.com/Gabriella439/foldl/pull/186) - Add [`Control.Foldl.NonEmpty.toFold`](https://github.com/Gabriella439/foldl/pull/191) - - [Generalize `fold1` to work with `Foldable1`](https://github.com/Gabriella439/foldl/pull/185) +- [Generalize `fold1` to work with `Foldable1`](https://github.com/Gabriella439/foldl/pull/185) 1.4.13 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/foldl-1.4.17/foldl.cabal new/foldl-1.4.18/foldl.cabal --- old/foldl-1.4.17/foldl.cabal 2001-09-09 03:46:40.000000000 +0200 +++ new/foldl-1.4.18/foldl.cabal 2001-09-09 03:46:40.000000000 +0200 @@ -1,5 +1,5 @@ Name: foldl -Version: 1.4.17 +Version: 1.4.18 Cabal-Version: >=1.10 Build-Type: Simple License: BSD3 @@ -60,7 +60,7 @@ HS-Source-Dirs: bench Main-Is: Foldl.hs Build-Depends: - base, + base >= 4.11.0.0 && < 5, criterion, foldl, profunctors @@ -72,7 +72,7 @@ HS-Source-Dirs: bench Main-Is: Scanl.hs Build-Depends: - base, + base >= 4.11.0.0 && < 5, criterion, foldl GHC-Options: -O2 -Wall -rtsopts -with-rtsopts=-T @@ -83,7 +83,7 @@ HS-Source-Dirs: test Main-Is: doctest.hs Build-Depends: - base, + base >= 4.11.0.0 && < 5, doctest >= 0.16 GHC-Options: -threaded Default-Language: Haskell2010 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/foldl-1.4.17/src/Control/Foldl/NonEmpty.hs new/foldl-1.4.18/src/Control/Foldl/NonEmpty.hs --- old/foldl-1.4.17/src/Control/Foldl/NonEmpty.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/foldl-1.4.18/src/Control/Foldl/NonEmpty.hs 2001-09-09 03:46:40.000000000 +0200 @@ -3,6 +3,7 @@ {-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE ViewPatterns #-} {-# LANGUAGE CPP #-} +{-# LANGUAGE MultiParamTypeClasses #-} {-| This module provides a `Fold1` type that is a \"non-empty\" analog of the `Fold` type, meaning that it requires at least one input element in order to @@ -57,16 +58,24 @@ , handles , foldOver , folded1 + , nest ) where import Control.Applicative (liftA2, Const(..)) +import Control.Arrow (Arrow (..), ArrowChoice (..)) +import Control.Category (Category ()) +import qualified Control.Category +import Control.Comonad (Comonad(..)) import Control.Foldl (Fold(..)) import Control.Foldl.Internal (Either'(..)) import Data.List.NonEmpty (NonEmpty(..)) import Data.Monoid (Dual(..)) -import Data.Functor.Apply (Apply) -import Data.Profunctor (Profunctor(..)) +import Data.Functor.Apply (Apply (..)) +import Data.Functor.Extend (Extend (..)) +import Data.Profunctor +import Data.Profunctor.Sieve (Cosieve(..)) import Data.Semigroup.Foldable (Foldable1(..), traverse1_) +import Data.Semigroupoid (Semigroupoid (..)) import Data.Functor.Contravariant (Contravariant(..)) import Prelude hiding (head, last, minimum, maximum) @@ -83,7 +92,7 @@
_2 f (x, y) = fmap (\i -> (x, i)) (f y)
->>> both f (x, y) = (,) <$> f x <.> f y +>>> both1 f (x, y) = (,) <$> f x <.> f y -} @@ -137,6 +146,18 @@ rmap = fmap {-# INLINE rmap #-} +instance Choice Fold1 where + right' = nest + {-# INLINE right' #-} + +instance Closed Fold1 where + closed = nest + {-# INLINE closed #-} + +instance Cosieve Fold1 NonEmpty where + cosieve = Control.Foldl.NonEmpty.fold1 + {-# INLINE cosieve #-} + instance Applicative (Fold1 a) where pure b = Fold1 (pure (pure b)) {-# INLINE pure #-} @@ -144,6 +165,10 @@ Fold1 l <*> Fold1 r = Fold1 (liftA2 (<*>) l r) {-# INLINE (<*>) #-} +instance Extend (Fold1 a) where + duplicated (Fold1 f) = Fold1 $ fmap fromFold . duplicated . f + {-# INLINE duplicated #-} + instance Semigroup b => Semigroup (Fold1 a b) where (<>) = liftA2 (<>) {-# INLINE (<>) #-} @@ -155,6 +180,36 @@ mappend = (<>) {-# INLINE mappend #-} +instance Semigroupoid Fold1 where + o (Fold1 l1) (Fold1 r1) = Fold1 f1 + where + f1 a = let r = r1 a + l = l1 $ extract r + in o l r + {-# INLINE o #-} + +instance Category Fold1 where + (.) = o + {-# INLINE (.) #-} + + id = last + {-# INLINE id #-} + +instance Strong Fold1 where + first' f = (,) <$> lmap fst f <*> lmap snd last + {-# INLINE first' #-} + +instance Arrow Fold1 where + arr f = f <$> last + {-# INLINE arr #-} + + first = first' + {-# INLINE first #-} + +instance ArrowChoice Fold1 where + left = left' + {-# INLINE left #-} + instance Num b => Num (Fold1 a b) where fromInteger = pure . fromInteger {-# INLINE fromInteger #-} @@ -404,7 +459,7 @@ {- | @(foldOver f folder xs)@ folds all values from a Lens, Traversal1 or Fold1 optic with the given folder ->>> foldOver (_2 . both) Foldl1.nonEmpty (1, (2, 3)) +>>> foldOver (_2 . both1) Foldl1.nonEmpty (1, (2, 3)) 2 :| [3]
Foldl1.foldOver f folder xs == Foldl1.fold1 folder (xs ^.. f) @@ -431,3 +486,12 @@ folded1 k ts = contramap (\_ -> ()) (traverse1_ k ts) {-# INLINABLE folded1 #-}
+{-| Nest a fold in an Apply. +-} +nest :: Apply f => Fold1 a b -> Fold1 (f a) (f b) +nest (Fold1_ i s e) = + Fold1_ + (fmap i) + (liftF2 s) + (fmap e) +{-# INLINABLE nest #-} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/foldl-1.4.17/src/Control/Foldl.hs new/foldl-1.4.18/src/Control/Foldl.hs --- old/foldl-1.4.17/src/Control/Foldl.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/foldl-1.4.18/src/Control/Foldl.hs 2001-09-09 03:46:40.000000000 +0200 @@ -118,6 +118,7 @@ , impurely_ , generalize , simplify + , lifts , hoists , duplicateM , _Fold1 @@ -162,6 +163,7 @@ import Data.HashMap.Strict (HashMap) import Data.Map.Strict (Map) import Data.Monoid hiding ((<>)) +import Data.Semigroup (Semigroup(stimes), stimesMonoid) import Data.Semigroupoid (Semigroupoid) import Data.Functor.Extend (Extend(..)) import Data.Profunctor @@ -219,7 +221,7 @@
in Control.Foldl.Optics.prism Just maybeEither :}
->>> both f (x, y) = (,) <$> f x <.> f y +>>> both f (x, y) = (,) <$> f x <*> f y -} @@ -245,9 +247,13 @@ rmap = fmap instance Choice Fold where - right' (Fold step begin done) = Fold (liftA2 step) (Right begin) (fmap done) + right' = nest {-# INLINE right' #-} +instance Closed Fold where + closed = nest + {-# INLINE closed #-} + instance Cosieve Fold [] where cosieve = fold {-# INLINE cosieve #-} @@ -1164,6 +1170,14 @@ hoists phi (FoldM step begin done) = FoldM (\a b -> phi (step a b)) (phi begin) (phi . done) {-# INLINABLE hoists #-} +{- | Lift a monadic value to a 'FoldM'; + works like 'Control.Monad.Trans.Class.lift'. + +> lifts . pure = pure +-} +lifts :: Monad m => m b -> FoldM m a b +lifts mb = FoldM (\() _ -> pure ()) (pure ()) (\() -> mb) + {-| Allows to continue feeding a 'FoldM' even after passing it to a function that closes it. @@ -1230,11 +1244,11 @@ {-| @(postmapM f folder)@ returns a new 'FoldM' where f is applied to the final value. -> postmapM return = id +> postmapM pure = id
postmapM (f >=> g) = postmapM g . postmapM f
-> postmapM k (pure r) = k r +> postmapM k (pure r) = lifts (k r) -} postmapM :: Monad m => (a -> m r) -> FoldM m x a -> FoldM m x r postmapM f (FoldM step begin done) = FoldM step begin done' @@ -1404,6 +1418,9 @@ (EndoM f) <> (EndoM g) = EndoM (f <=< g) {-# INLINE (<>) #-} + stimes = stimesMonoid + {-# INLINE stimes #-} + instance Monad m => Monoid (EndoM m a) where mempty = EndoM return {-# INLINE mempty #-}
participants (1)
-
Source-Sync