packages feed

deferred-folds 0.9.10.1 → 0.9.11

raw patch · 4 files changed

+24/−3 lines, 4 filesdep ~bytestringPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: bytestring

API changes (from Hackage documentation)

+ DeferredFolds.Unfoldr: intersperse :: a -> Unfoldr a -> Unfoldr a

Files

deferred-folds.cabal view
@@ -1,5 +1,5 @@ name: deferred-folds-version: 0.9.10.1+version: 0.9.11 category: Folding synopsis: Abstractions over deferred folds description:@@ -38,7 +38,7 @@     DeferredFolds.Prelude   build-depends:     base >=4.9 && <5,-    bytestring >=0.10 && <0.11,+    bytestring >=0.10 && <0.12,     containers >=0.5 && <0.7,     foldl >=1 && <2,     hashable >=1 && <2,
library/DeferredFolds/Defs/Unfoldr.hs view
@@ -319,3 +319,20 @@  snoc :: a -> Unfoldr a -> Unfoldr a snoc a (Unfoldr unfoldr) = Unfoldr $ \ step init -> unfoldr step (step a init)++{-|+Insert a separator value between each element.++Behaves the same way as 'Data.List.intersperse'.+-}+{-# INLINE intersperse #-}+intersperse :: a -> Unfoldr a -> Unfoldr a+intersperse sep (Unfoldr unfoldr) =+  Unfoldr $ \ step init ->+    unfoldr+      (\ a next first ->+        if first+          then step a (next False)+          else step sep (step a (next False)))+      (const init)+      True
library/DeferredFolds/Types.hs view
@@ -13,7 +13,7 @@  [Intuition] -The intuition of what this abstraction is all about can be derived from lists.+The intuition for this abstraction can be derived from lists.  Let's consider the `Data.List.foldl'` function for lists: 
test/Main.hs view
@@ -24,4 +24,8 @@     testProperty "takeWhile odd" $ \ (list :: [Int]) ->     takeWhile odd list ===     toList (Unfoldr.takeWhile odd (Unfoldr.foldable list))+    ,+    testProperty "intersperse" $ \ (list :: [Char]) -> +    intersperse ',' list ===+    toList (Unfoldr.intersperse ',' (Unfoldr.foldable list))   ]