packages feed

pipes-transduce 0.3.1.0 → 0.3.2.0

raw patch · 3 files changed

+25/−3 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Pipes.Transduce.Text: eachLine :: (Text -> IO (Either e ())) -> Fold1 Text e ()

Files

CHANGELOG view
@@ -1,7 +1,12 @@+0.3.2.0+=======++- Added "eachLine" function.+ 0.3.1.0 ======= -- Solved bug in "combined, added a test.+- Solved bug in "combined", added a test.  0.3.0.0 =======
pipes-transduce.cabal view
@@ -1,5 +1,5 @@ Name: pipes-transduce-Version: 0.3.1.0+Version: 0.3.2.0 Cabal-Version: >=1.8.0.2 Build-Type: Simple License: BSD3
src/Pipes/Transduce/Text.hs view
@@ -8,6 +8,7 @@     ,   lines_         -- * Grouping     ,   foldedLines+    ,   eachLine         -- * Decoding     ,   decoder     ,   decoderx@@ -18,14 +19,17 @@ import Prelude hiding (lines) import Data.ByteString import qualified Data.Text +import qualified Data.Text.Lazy import Data.Text hiding (lines) import Data.Text.Encoding.Error (UnicodeException(..)) import qualified Control.Foldl as Foldl import Control.Exception+import Control.Monad+import Control.Monad.Trans.Class+import Control.Monad.Trans.Except import Pipes  import qualified Pipes.Text import Pipes.Text.Encoding (decodeUtf8) -import qualified Data.Text.Lazy import Lens.Family (view)  import Pipes.Transduce@@ -57,6 +61,19 @@     Pipes.Transduce.folds      (fmap Data.Text.Lazy.fromChunks (Pipes.Transduce.withFold Foldl.list))      (lines_ (Pipes.Transduce.mapper id))+++{-| +    Split the stream into lines, collect them into lazy 'Text' values, and+    apply an effectul function to each line.++>>> PT.fold1Fallibly (eachLine $ \l -> pure $ if TL.head l == 'b' then (Left l) else (Right ())) (mapM_ yield ["aa","\nbb"]) +Left "bb"++-}+eachLine :: (Data.Text.Lazy.Text -> IO (Either e ())) -> Fold1 Data.Text.Text e ()+eachLine action = transduce1 foldedLines (withFallibleConsumer (forever (do+    await >>= lift . ExceptT . action)))  {-|      Split into lines, eliding newlines.