packages feed

pipes-bytestring 2.1.4 → 2.1.5

raw patch · 2 files changed

+14/−1 lines, 2 files

Files

pipes-bytestring.cabal view
@@ -1,5 +1,5 @@ Name: pipes-bytestring-Version: 2.1.4+Version: 2.1.5 Cabal-Version: >=1.8.0.2 Build-Type: Simple License: BSD3
src/Pipes/ByteString.hs view
@@ -80,6 +80,7 @@     -- * Folds     , toLazy     , toLazyM+    , toLazyM'     , foldBytes     , head     , last@@ -426,6 +427,18 @@ toLazyM :: Monad m => Producer ByteString m () -> m BL.ByteString toLazyM = liftM BL.fromChunks . P.toListM {-# INLINABLE toLazyM #-}++{-| Fold an effectful 'Producer' of strict 'ByteString's into a lazy+    'BL.ByteString' alongside the return value++    Note: 'toLazyM'' is not an idiomatic use of @pipes@, but I provide it for+    simple testing purposes.  Idiomatic @pipes@ style consumes the chunks+    immediately as they are generated instead of loading them all into memory.+-}+toLazyM' :: Monad m => Producer ByteString m a -> m (BL.ByteString, a)+toLazyM' p = do (chunks, a) <- P.toListM' p+                return (BL.fromChunks chunks, a)+{-# INLINABLE toLazyM' #-}  {-| Reduce the stream of bytes using a strict left fold