HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

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
valuedecode
  1. :: (Binary a, Monad m)
  2. => ByteString m r
  3. -> m (ByteString m r, Int64, Either String a)
#

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.

valuedecoded
  1. :: (Binary a, Monad m)
  2. => ByteString m r
  3. -> Stream (Of a) m (ByteString m r, Int64, Either String r)
#

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.