conduit 1.1.1.1 → 1.1.2
raw patch · 3 files changed
+27/−1 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.Conduit.List: unfoldM :: Monad m => (b -> m (Maybe (a, b))) -> b -> Producer m a
Files
- Data/Conduit/List.hs +17/−0
- conduit.cabal +1/−1
- test/main.hs +9/−0
Data/Conduit/List.hs view
@@ -13,6 +13,7 @@ sourceList , sourceNull , unfold+ , unfoldM , enumFromTo , iterate -- * Sinks@@ -91,6 +92,22 @@ where go seed = case f seed of+ Just (a, seed') -> yield a >> go seed'+ Nothing -> return ()++-- | A monadic unfold.+--+-- Since 1.1.2+unfoldM :: Monad m+ => (b -> m (Maybe (a, b)))+ -> b+ -> Producer m a+unfoldM f =+ go+ where+ go seed = do+ mres <- lift $ f seed+ case mres of Just (a, seed') -> yield a >> go seed' Nothing -> return ()
conduit.cabal view
@@ -1,5 +1,5 @@ Name: conduit-Version: 1.1.1.1+Version: 1.1.2 Synopsis: Streaming data processing library. Description: @conduit@ is a solution to the streaming data problem, allowing for production, transformation, and consumption of streams of data in constant memory. It is an alternative to lazy I\/O which guarantees deterministic resource handling, and fits in the same general solution space as @enumerator@\/@iteratee@ and @pipes@. For a tutorial, please visit <https://haskell.fpcomplete.com/user/snoyberg/library-documentation/conduit-overview>.
test/main.hs view
@@ -143,6 +143,15 @@ let y = DL.unfoldr f seed x `shouldBe` y + describe "unfoldM" $ do+ it "works" $ do+ let f 0 = Nothing+ f i = Just (show i, i - 1)+ seed = 10 :: Int+ x <- CL.unfoldM (return . f) seed C.$$ CL.consume+ let y = DL.unfoldr f seed+ x `shouldBe` y+ describe "Monoid instance for Source" $ do it "mappend" $ do x <- runResourceT $ (CL.sourceList [1..5 :: Int] `mappend` CL.sourceList [6..10]) C.$$ CL.fold (+) 0