-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Encode and decode binary streams using the pipes and binary libraries.
--
-- Encode and decode binary streams using the Pipes and
-- binary libraries.
--
-- See the NEWS file in the source distribution to learn about
-- any important changes between version.
@package pipes-binary
@version 0.1.0.0
-- | This module exports facilities that allows you to encode and decode
-- streams of Binary values using the pipes and
-- pipes-parse libraries.
module Control.Proxy.Binary
-- | Decodes one Binary instance flowing downstream.
--
--
-- - In case of decoding errors, a DecodingError exception is
-- thrown in the EitherP proxy transformer.
-- - Requests more input from upstream using draw when
-- needed.
-- - Do not use this proxy if isEndOfBytes returns
-- True, otherwise you may get unexpected decoding errors.
--
decode :: (Proxy p, Monad m, Binary r) => EitherP DecodingError (StateP [ByteString] p) () (Maybe ByteString) y' y m r
-- | Decodes Binary instances flowing downstream until end of input.
--
--
-- - In case of decoding errors, a DecodingError exception is
-- thrown in the EitherP proxy transformer.
-- - Requests more input from upstream using draw, when
-- needed.
-- - Empty input chunks flowing downstream will be discarded.
--
decodeD :: (Proxy p, Monad m, Binary b) => () -> Pipe (EitherP DecodingError (StateP [ByteString] p)) (Maybe ByteString) b m ()
-- | Encodes the given Binary instance and sends it downstream in
-- ByteString chunks.
encode :: (Proxy p, Monad m, Binary x) => x -> p x' x () ByteString m ()
-- | Encodes Binary instances flowing downstream, each in possibly
-- more than one ByteString chunk.
encodeD :: (Proxy p, Monad m, Binary a) => () -> Pipe p a ByteString m r
data DecodingError
DecodingError :: ByteOffset -> String -> DecodingError
-- | Number of bytes consumed before the error.
peConsumed :: DecodingError -> ByteOffset
-- | Error message.
peMessage :: DecodingError -> String