packages feed

deferred-folds 0.9.4 → 0.9.5

raw patch · 2 files changed

+11/−1 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ DeferredFolds.Unfoldr: zipWithIndex :: Unfoldr a -> Unfoldr (Int, a)

Files

deferred-folds.cabal view
@@ -1,5 +1,5 @@ name: deferred-folds-version: 0.9.4+version: 0.9.5 category: Folding synopsis: Abstractions over deferred folds description:
library/DeferredFolds/Defs/Unfoldr.hs view
@@ -220,8 +220,18 @@ reverse (Unfoldr unfoldr) = Unfoldr $ \ step -> unfoldr (\ a f -> f . step a) id  {-|+Lift into an unfold, which produces pairs with index.+-}+zipWithIndex :: Unfoldr a -> Unfoldr (Int, a)+zipWithIndex (Unfoldr unfoldr) = Unfoldr $ \ indexedStep indexedState -> unfoldr+  (\ a nextStateByIndex index -> indexedStep (index, a) (nextStateByIndex (succ index)))+  (const indexedState)+  0++{-| Lift into an unfold, which produces pairs with right-associative index. -}+{-# DEPRECATED zipWithReverseIndex "This function builds up stack. Use 'zipWithIndex' instead." #-} zipWithReverseIndex :: Unfoldr a -> Unfoldr (Int, a) zipWithReverseIndex (Unfoldr unfoldr) = Unfoldr $ \ step init -> snd $ unfoldr   (\ a (index, state) -> (succ index, step (index, a) state))