Decode a single element from a streaming bytestring. Returns any leftover input, the number of bytes consumed, and either an error string or the element if decoding succeeded.
Modulestreaming-binary-0.3.0.1Haskell2010
Streaming.Binary
This module implements a method to ingest a sequence of Data.Binary encoded records using bounded memory. Minimal example:
{-# LANGUAGE TypeApplications #-}
import Data.Function ((&))
import qualified Data.ByteString.Streaming as Q
import Streaming
import Streaming.Binary
import qualified Streaming.Prelude as S
-- Interpret all bytes on stdin as a sequence of integers.
-- Print them on-the-fly on stdout.
main = Q.getContents & decoded @Int & S.print- 8 values
- Packagestreaming-binary-0.3.0.1
- Exports8
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceBinary.hs
Like decode, but with an explicitly provided decoder.
Decode a sequence of elements from a streaming bytestring. Returns any leftover input, the number of bytes consumed, and either an error string or the return value if there were no errors. Decoding stops at the first error.
Like decoded, but with an explicitly provided decoder.
Encode a single element.
Like encode, but with an explicitly provided encoder.
Encode a stream of elements to a streaming bytestring.
Like encoded, but with an explicitly provided encoder.