quiver-bytestring-0.0.0.2: Quiver combinators for bytestring streaming

Copyright© 2015 Patryk Zadarnowski <pat@jantar.org>
LicenseBSD3
Maintainerpat@jantar.org
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Control.Quiver.ByteString

Description

When binary data is streamed through a Quiver processor, it's often partitioned arbitrarily into packets with no semantic significance, beyond facilitation of processing in constant space. This is similar to the chunking mechanism within lazy bytestrings, and, accordingly, it's often convenient to unify the two mechanisms, by converting between processors over lazy bytestrings and processors over strict chunks of these bytestrings. This module provides efficient implementations of these conversions.

Synopsis

Documentation

toChunks :: Functor f => SP Lazy.ByteString ByteString.ByteString f () Source

A processors that converts a stream of lazy bytestrings into a stream of their chunks.

fromChunks :: Functor f => Int64 -> Int64 -> SP ByteString.ByteString Lazy.ByteString f [ByteString.ByteString] Source

A processors that converts a stream of strict bytestring chunks into a stream of lazy bytestrings with the specified minimum and maximum size, without copying any data. If the input does not provide enough data to complete the final byte string of the minimum requested length, the stream processor will fail with the incomplete list of chunks.

fromChunks' :: Monad f => Int64 -> Int64 -> SP ByteString.ByteString Lazy.ByteString f e Source

A processors that converts a stream of strict bytestring chunks into a stream of lazy bytestrings with the specified minimum and maximum size, without copying any data. This processor always emits all of its input, so if the input does not provide enough data to complete the final byte string of the minimum requested length, the final byte string emitted by the stream will be shorter than the requested minimum.