HORIZON HASKELLDocslts/ghc-10.0.x2b276322026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 2b27632 · 2026-10-31

Modulebinary-0.8.9.3Haskell2010

Data.Binary.Builder

Efficient constructions of lazy bytestrings.

This now re-exports Data.ByteString.Lazy.Builder.

Contents
  1. The Builder type
  2. Constructing Builders
  3. Flushing the buffer state
  4. Derived Builders
  5. Big-endian writes
  6. Little-endian writes
  7. Host-endian, unaligned writes
  8. Unicode
Synopsis
  • Packagebinary-0.8.9.3
  • Exports31
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceBuilder.hs

The Builder type

newtypenewtype Builder

Builders denote sequences of bytes. They are Monoids where mempty is the zero-length sequence and mappend is concatenation, which runs in O(1).

Instances6IsList, Show, IsString, Semigroup, Monoid, Item
  • IsList BuilderDefined in bytestring-0.12.2.0 · Data.ByteString.Builder.Internal

    For long or infinite lists use fromList because it uses LazyByteString otherwise use fromListN which uses StrictByteString.

  • Show BuilderDefined in bytestring-0.12.2.0 · Data.ByteString.Builder · orphan
  • IsString BuilderDefined in bytestring-0.12.2.0 · Data.ByteString.Builder · orphan
  • Semigroup BuilderDefined in bytestring-0.12.2.0 · Data.ByteString.Builder.Internal
  • Monoid BuilderDefined in bytestring-0.12.2.0 · Data.ByteString.Builder.Internal
  • type Item Builder = Word8Defined in bytestring-0.12.2.0 · Data.ByteString.Builder.Internal

Constructing Builders

Flushing the buffer state

Derived Builders

Big-endian writes

Little-endian writes

Host-endian, unaligned writes

O(1). A Builder taking a single native machine word. The word is written in host order, host endian form, for the machine you're on. On a 64 bit machine the Word is an 8 byte value, on a 32 bit machine, 4 bytes. Values written this way are not portable to different endian or word sized machines, without conversion.

Write a Word64 in native host order. On a 32 bit machine we write two host order Word32s, in big endian form. 8 bytes will be written, unaligned.

valueputInthost :: Int -> Builder

O(1). A Builder taking a single native machine word. The word is written in host order, host endian form, for the machine you're on. On a 64 bit machine the Int is an 8 byte value, on a 32 bit machine, 4 bytes. Values written this way are not portable to different endian or word sized machines, without conversion.

Write a Int64 in native host order. On a 32 bit machine we write two host order Int32s, in big endian form. 8 bytes will be written, unaligned.

Unicode