packages feed

streaming-utils 0.1.1.1 → 0.1.2.0

raw patch · 2 files changed

+41/−14 lines, 2 filesdep ~streamingdep ~streaming-bytestring

Dependency ranges changed: streaming, streaming-bytestring

Files

Streaming/Pipes.hs view
@@ -38,8 +38,10 @@  module Streaming.Pipes (   -- * @Streaming@ \/ @Pipes@ interoperation-  produce,-  stream,+  fromStream,+  toStream,+  toStreamingByteString,+  fromStreamingByteString,      -- * Transforming a connected stream of 'Producer's   takes,@@ -71,7 +73,7 @@   ) where  import Pipes-import Streaming hiding (concats)+import Streaming hiding (concats, groups) import qualified Streaming.Internal as SI import qualified Pipes.Internal as PI import qualified Pipes.Prelude as P@@ -81,25 +83,50 @@ import qualified Streaming.Prelude as S import Control.Monad (liftM) import Prelude hiding (span, splitAt, break)+import qualified Data.ByteString as B+import qualified Data.ByteString.Streaming as Q+import qualified Data.ByteString.Streaming.Internal as Q + -- | Construct an ordinary pipes 'Producer' from a 'Stream' of elements-produce :: Monad m => Stream (Of a) m r -> Producer' a m r-produce = loop where+fromStream :: Monad m => Stream (Of a) m r -> Producer' a m r+fromStream = loop where   loop stream = case stream of -- this should be rewritten without constructors     SI.Return r -> PI.Pure r     SI.Delay m  -> PI.M (liftM loop m)     SI.Step (a:>rest) -> PI.Respond a  (\_ -> loop rest)-{-# INLINABLE produce #-}+{-# INLINABLE fromStream #-}  -- | Construct a 'Stream' of elements from a @pipes@ 'Producer'-stream :: Monad m => Producer a m r -> Stream (Of a) m r-stream = loop where+toStream :: Monad m => Producer a m r -> Stream (Of a) m r+toStream = loop where   loop stream = case stream of     PI.Pure r -> SI.Return r      PI.M m -> SI.Delay (liftM loop m)     PI.Respond a f -> SI.Step (a :> loop (f ()))     PI.Request x g -> PI.closed x-{-# INLINABLE stream #-}+{-# INLINABLE toStream #-}+++toStreamingByteString :: Monad m => Producer B.ByteString m r -> Q.ByteString m r+toStreamingByteString = loop where+  loop stream = case stream of+    PI.Pure r -> Q.Empty r +    PI.M m    -> Q.Go (liftM loop m)+    PI.Respond a f -> Q.Chunk a (loop (f ()))+    PI.Request x g -> PI.closed x+{-# INLINABLE toStreamingByteString #-}+++fromStreamingByteString :: Monad m => Q.ByteString m r -> Producer' B.ByteString m r+fromStreamingByteString = loop where+  loop stream = case stream of -- this should be rewritten without constructors+    Q.Empty r      -> PI.Pure r+    Q.Go m         -> PI.M (liftM loop m)+    Q.Chunk a rest -> PI.Respond a  (\_ -> loop rest)+{-# INLINABLE fromStreamingByteString #-}++  {-| 'span' splits a 'Producer' into two 'Producer's; the outer 'Producer'      is the longest consecutive group of elements that satisfy the predicate.
streaming-utils.cabal view
@@ -1,7 +1,7 @@ name:                streaming-utils-version:             0.1.1.1-synopsis:            http, attoparsec and pipes utilities for streaming and streaming-bytestring-description:         Experimental http-client, attoparsec and pipes utilities for use with+version:             0.1.2.0+synopsis:            http, attoparsec, pipes and conduit utilities for the streaming libraries+description:         Experimental http-client, attoparsec, conduit pipes utilities for use with                      the <http://hackage.haskell.org/package/streaming streaming> and                       <http://hackage.haskell.org/package/streaming-bytestring streaming bytestring> libraries.                      Other modules are planned. @@ -41,8 +41,8 @@                        transformers >=0.4 && <0.5,                         mtl >=2.2 && <2.3,                        attoparsec >=0.13.0.1,-                       streaming > 0.1.0.20 && < 0.1.1.2,-                       streaming-bytestring > 0.1.0.8 && < 0.1.1.2,+                       streaming > 0.1.1.1 && < 0.1.2.2,+                       streaming-bytestring > 0.1.1.1 && < 0.1.2.2,                        bytestring,                         pipes >= 4.0 && < 4.2,                        http-client >=0.2 && <0.5,