streaming-utils

http, attoparsec, pipes and other utilities for the streaming libraries

https://github.com/michaelt/streaming-utils

Version on this page:0.1.4.7
LTS Haskell 9.21:0.1.4.7
Stackage Nightly 2017-07-25:0.1.4.7
Latest on Hackage:0.2.6.0

See all snapshots streaming-utils appears in

BSD-3-Clause licensed by michaelt
Maintained by [email protected]
This version can be pinned in stack with:streaming-utils-0.1.4.7@sha256:e39f5c8f975a193ebe11dedf33611308dad76d55b4fdc0a9b61aef359862b65b,4189

Module documentation for 0.1.4.7

This package includes http-client, aeson, attoparsec, zlib and pipes utilities for use with the streaming and streaming bytestring libraries. The modules generally closely follow similarly named modules in the pipes 'ecosystem', using similar function names, where possible.

Thus, for example, using the http client module, we might number the lines of a remote document thus:

import Streaming
import Streaming.Prelude (with, each)
import qualified Streaming.Prelude as S
import Data.ByteString.Streaming.HTTP
import qualified Data.ByteString.Streaming.Char8 as Q

main =  runResourceT $ do
   let output = numbers <|> Q.lines (simpleHTTP "http://lpaste.net/raw/146542")
   Q.putStrLn $ Q.unlines output

numbers :: Monad m => Stream (Q.ByteString m) m ()
numbers = with (each [1..]) $ \n -> Q.pack (each (show n ++ ".  "))
-- ["1. ", "2. " ..]

The memory requirements of this Prelude-ish program will not be affected by the fact that, say, the third 'line' is 10 terabytes long.

This package of course heaps together a number of dependencies, as it seemed best not to spam hackage with numerous packages. If it seems reasonable to detach some of it, please raise an issue on the github page.

Questions about usage can be raised as issues, or addressed to the pipes list.