packages feed

streaming-utils 0.1.2.0 → 0.1.2.2

raw patch · 3 files changed

+29/−17 lines, 3 filesdep ~json-streamdep ~streamingdep ~streaming-bytestring

Dependency ranges changed: json-stream, streaming, streaming-bytestring

Files

Data/ByteString/Streaming/Aeson.hs view
@@ -74,6 +74,10 @@ encode :: (Monad m, Ae.ToJSON a) => a -> ByteString m () encode = fromLazy . Ae.encode ++{-| Given a bytestring, parse a top level json entity - returning any leftover+    bytes. +-} decode   :: (Monad m, Ae.FromJSON a)   => StateT (ByteString m x) m (Either DecodingError a)@@ -85,6 +89,10 @@             Ae.Error e   -> Left (FromJSONError e)             Ae.Success a -> Right a +{-| Resolve a succession of top-level json items into a corresponding stream of Haskell+    values. +            +-} decoded  :: (Monad m, Ae.FromJSON a) =>      ByteString m r      -> Stream (Of a) m (Either (DecodingError, ByteString m r) r)@@ -122,9 +130,13 @@      The function will read through      the whole of a single top level json entity, streaming the valid parses as they      arise. (It will thus for example parse an infinite json bytestring, though these-     are rare in practice ...) If the parser is fitted to recognize only one thing, +     are rare in practice ...) +                           +     If the parser is fitted to recognize only one thing,       then zero or one item will be yielded; if it uses combinators like @arrayOf@, -     it will stream many values as they arise. This function is modelled on +     it will stream many values as they arise. +                           +     This function is closely modelled on       'Data.JsonStream.Parser.parseByteString' and       'Data.JsonStream.Parser.parseLazyByteString'                            
Streaming/Pipes.hs view
@@ -93,7 +93,7 @@ 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.Effect m  -> PI.M (liftM loop m)     SI.Step (a:>rest) -> PI.Respond a  (\_ -> loop rest) {-# INLINABLE fromStream #-} @@ -102,7 +102,7 @@ toStream = loop where   loop stream = case stream of     PI.Pure r -> SI.Return r -    PI.M m -> SI.Delay (liftM loop m)+    PI.M m -> SI.Effect (liftM loop m)     PI.Respond a f -> SI.Step (a :> loop (f ()))     PI.Request x g -> PI.closed x {-# INLINABLE toStream #-}@@ -216,7 +216,7 @@     => (a -> a -> Bool)     -> Producer a m r -> Stream (Producer a m) m r  groupsBy equals = loop where-  loop p = SI.Delay $ do+  loop p = SI.Effect $ do     e <- next p     return $ case e of       Left   r      -> SI.Return r@@ -241,7 +241,7 @@     :: Monad m     => (a -> a -> Bool) -> Producer a m r -> Stream (Producer a m) m r groupsBy' equals = loop where-  loop p = SI.Delay $ do+  loop p = SI.Effect $ do     e <- next p     return $ case e of       Left   r      -> SI.Return r@@ -272,7 +272,7 @@ chunksOf     :: Monad m => Int -> Producer a m r -> Stream (Producer a m) m r chunksOf n = loop where-  loop p = SI.Delay $ do+  loop p = SI.Effect $ do     e <- next p     return $ case e of       Left   r      -> SI.Return r@@ -284,7 +284,7 @@ concats = loop where   loop stream = case stream of     SI.Return r -> return r-    SI.Delay m -> PI.M $ liftM loop m+    SI.Effect m -> PI.M $ liftM loop m     SI.Step p -> do        rest <- p       loop rest @@ -351,7 +351,7 @@ folds step begin done = loop where   loop stream = case stream of      SI.Return r -> return r-    SI.Delay m  -> PI.M $ liftM loop m+    SI.Effect m  -> PI.M $ liftM loop m     SI.Step p   -> do         (stream', b) <- lift (fold p begin)         yield b@@ -384,7 +384,7 @@ foldsM step begin done = loop where   loop stream = case stream of      SI.Return r -> return r-    SI.Delay m -> PI.M (liftM loop m)+    SI.Effect m -> PI.M (liftM loop m)     SI.Step p -> do       (f', b) <- lift $ begin >>=  foldM p        yield b@@ -414,13 +414,13 @@   loop !n stream | n <= 0 = drain_loop stream   loop n stream = case stream of     SI.Return r -> SI.Return r-    SI.Delay  m -> SI.Delay (liftM (loop n) m)+    SI.Effect  m -> SI.Effect (liftM (loop n) m)     SI.Step p   -> SI.Step  (fmap (loop (n - 1)) p)    drain_loop stream = case stream of     SI.Return r -> SI.Return r-    SI.Delay  m -> SI.Delay (liftM drain_loop m)-    SI.Step p   -> SI.Delay $ do +    SI.Effect  m -> SI.Effect (liftM drain_loop m)+    SI.Step p   -> SI.Effect $ do        stream' <- runEffect (P.for p P.discard)       return $ drain_loop stream' {-# INLINABLE takes' #-}
streaming-utils.cabal view
@@ -1,5 +1,5 @@ name:                streaming-utils-version:             0.1.2.0+version:             0.1.2.2 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 @@ -41,14 +41,14 @@                        transformers >=0.4 && <0.5,                         mtl >=2.2 && <2.3,                        attoparsec >=0.13.0.1,-                       streaming > 0.1.1.1 && < 0.1.2.2,-                       streaming-bytestring > 0.1.1.1 && < 0.1.2.2,+                       streaming > 0.1.2.0 && < 0.1.2.4,+                       streaming-bytestring  > 0.1.2.0 && < 0.1.2.4,                        bytestring,                         pipes >= 4.0 && < 4.2,                        http-client >=0.2 && <0.5,                         http-client-tls <0.3,                        aeson,-                       json-stream == 0.3.2.*+                       json-stream == 0.4.0.*                                                  -- hs-source-dirs: