deferred-folds 0.7.2 → 0.8
raw patch · 2 files changed
+4/−9 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- DeferredFolds.Unfoldr: unfoldrM :: UnfoldrM Identity input -> Unfoldr input
- DeferredFolds.Unfoldr: zipWithIndex :: Unfoldr a -> Unfoldr (Int, a)
+ DeferredFolds.Unfoldr: zipWithReverseIndex :: Unfoldr a -> Unfoldr (Int, a)
Files
deferred-folds.cabal view
@@ -1,5 +1,5 @@ name: deferred-folds-version: 0.7.2+version: 0.8 category: Folding synopsis: Abstractions over deferred folds description:
library/DeferredFolds/Defs/Unfoldr.hs view
@@ -58,11 +58,6 @@ fold :: Fold input output -> Unfoldr input -> output fold (Fold step init extract) = extract . foldl' step init -{-| Unlift a monadic unfold -}-{-# INLINE unfoldrM #-}-unfoldrM :: UnfoldrM Identity input -> Unfoldr input-unfoldrM (UnfoldrM runFoldM) = Unfoldr (\ step init -> runIdentity (runFoldM (\ a b -> return (step a b)) init))- {-| Construct from any foldable -} {-# INLINE foldable #-} foldable :: Foldable foldable => foldable a -> Unfoldr a@@ -154,9 +149,9 @@ reverse (Unfoldr unfoldr) = Unfoldr $ \ step -> unfoldr (\ a f -> f . step a) id {-|-Lift into an unfold, which produces pairs with index.+Lift into an unfold, which produces pairs with right-associative index. -}-zipWithIndex :: Unfoldr a -> Unfoldr (Int, a)-zipWithIndex (Unfoldr unfoldr) = Unfoldr $ \ step init -> snd $ unfoldr+zipWithReverseIndex :: Unfoldr a -> Unfoldr (Int, a)+zipWithReverseIndex (Unfoldr unfoldr) = Unfoldr $ \ step init -> snd $ unfoldr (\ a (index, state) -> (succ index, step (index, a) state)) (0, init)