Safe Haskell | None |
---|---|
Language | Haskell2010 |
Splitting functions for ByteString m r
into Stream (ByteString m) m r
.
TODO These functions need quickcheck tests.
Synopsis
- splitsByteStringAt :: Monad m => Int -> ByteString m r -> Stream (ByteString m) m r
- separatesByteString :: Monad m => (ByteString m r -> ByteString m (ByteString m r)) -> ByteString m r -> Stream (ByteString m) m r
Documentation
splitsByteStringAt :: Monad m => Int -> ByteString m r -> Stream (ByteString m) m r Source #
Split a ByteString m r
after every k
characters.
Streams in constant memory.
BUG: Once the stream is exhausted, it will still call splitAt
, forever
creating empty ByteString
s.
separatesByteString :: Monad m => (ByteString m r -> ByteString m (ByteString m r)) -> ByteString m r -> Stream (ByteString m) m r Source #
For lists, this would be sbs (f :: [a] -> ([a],[a])) -> [a] -> [[a]]
.
Takes a function that splits the bytestring into two elements repeatedly,
where the first is followed by the repeated application of the function.
cf. http://hackage.haskell.org/package/streaming-utils-0.1.4.7/docs/src/Streaming-Pipes.html#chunksOf
TODO these functions should go into a helper library