process-streaming 0.7.0.1 → 0.7.0.2
raw patch · 5 files changed
+27/−6 lines, 5 filesdep ~conceitPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: conceit
API changes (from Hackage documentation)
Files
- CHANGELOG +4/−0
- process-streaming.cabal +2/−2
- src/System/Process/Lens.hs +3/−0
- src/System/Process/Streaming.hs +17/−3
- src/System/Process/Streaming/Tutorial.hs +1/−1
CHANGELOG view
@@ -1,3 +1,7 @@+0.7.0.2+-------+- Bumped conceit dependency to make it work with GHC 7.10.+ 0.7.0.0 ------- - Changed signature of toLines to make it more consistent with that of encoded
process-streaming.cabal view
@@ -1,5 +1,5 @@ name: process-streaming-version: 0.7.0.1+version: 0.7.0.2 license: BSD3 license-file: LICENSE data-files: @@ -44,7 +44,7 @@ void >= 0.6 && < 1.0, containers >= 0.4, semigroups >= 0.15 && < 0.20,- conceit >= 0.2.1.0 && < 0.3.0.0,+ conceit >= 0.2.2.1 && < 0.3.0.0, contravariant >= 1.2, foldl >= 1.0.7
src/System/Process/Lens.hs view
@@ -2,6 +2,9 @@ -- | -- Lenses and traversals for 'CreateProcess' and related types. --+-- These are provided as a convenience and aren't required to use the other+-- modules of the package.+-- ----------------------------------------------------------------------------- {-# LANGUAGE DeriveDataTypeable #-}
src/System/Process/Streaming.hs view
@@ -100,6 +100,7 @@ , T.decodeIso8859_1 ) where +import qualified Data.ByteString as BS import qualified Data.ByteString.Lazy as BL import Data.Functor.Contravariant import Data.Functor.Contravariant.Divisible@@ -346,9 +347,16 @@ fromLazyBytes = fromProducer . fromLazy +{-| + Collects incoming 'BS.ByteString' values into a lazy 'BL.ByteString'.+-} intoLazyBytes :: Siphon ByteString e BL.ByteString intoLazyBytes = fromFold toLazyM ++{-| + Collects incoming 'Data.Text' values into a lazy 'TL.Text'.+-} intoLazyText :: Siphon Text e TL.Text intoLazyText = fromFold T.toLazyM @@ -366,12 +374,14 @@ {-| Builds a 'Siphon' out of a computation that drains a 'Producer' completely, but may fail with an error of type @e@.++ This functions incurs in less overhead than 'siphon'. -} siphon' :: (forall r. Producer b IO r -> IO (Either e (a,r))) -> Siphon b e a siphon' f = Siphon (Other (Exhaustive f)) {-| - Useful in combination with folds from the pipes prelude or more+ Useful in combination with folds from the pipes prelude, or more specialized folds like 'Pipes.Text.toLazyM' from @pipes-text@ and 'Pipes.ByteString.toLazyM' from @pipes-bytestring@. -}@@ -416,6 +426,10 @@ fromConsumer :: Consumer b IO () -> Siphon b e () fromConsumer consumer = fromFold $ \producer -> runEffect $ producer >-> consumer +{-| + Builds a 'Siphon' out of a 'Consumer' with a polymorphic return type+ (one example is 'toHandle' from @pipes-bytestring@).+-} fromConsumer' :: Consumer b IO Void -> Siphon b e () fromConsumer' consumer = fromFold'_$ \producer -> runEffect $ producer >-> fmap absurd consumer @@ -438,7 +452,7 @@ fromFallibleConsumer = fromConsumerM' (fmap (fmap (\r -> ((), r))) . runExceptT) {-| - Turn a 'Parser' from @pipes-parse@ into a 'Sihpon'.+ Turn a 'Parser' from @pipes-parse@ into a 'Siphon'. -} fromParser :: Parser b IO (Either e a) -> Siphon b e a fromParser parser = siphon' $ \producer -> drainage $ Pipes.Parse.runStateT parser producer@@ -451,7 +465,7 @@ Right a' -> return (Right (a',r)) {-| - Turn a 'Parser' from @pipes-parse@ into a 'Sihpon'.+ Turn a 'Parser' from @pipes-parse@ into a 'Siphon'. -} fromParserM :: MonadIO m => (forall r. m (a,r) -> IO (Either e (c,r)))
src/System/Process/Streaming/Tutorial.hs view
@@ -159,7 +159,7 @@ Notice also that we had to switch from 'execute' to 'executeFallibly'. This is because, for the first time in the tutorial, we actually have a need for-the error type. 'execute' only works when the error type unified with 'Void'.+the error type. 'execute' only works when the error type unifies with 'Void'. Beware: even if the error type is 'Void', exceptions can still be thrown. -}