HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulebinary-0.8.9.3Haskell2010

Data.Binary.Builder

Efficient constructions of lazy bytestrings.

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

  • 1 type
  • 30 values
  • Packagebinary-0.8.9.3
  • Exports31
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceBuilder.hs

The Builder type

2 declarations
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

6 declarations

Flushing the buffer state

1 declaration
valueflush :: Builder
#

Flush the current buffer. This introduces a chunk boundary.

Derived Builders

0 declarations

Big-endian writes

Little-endian writes

Host-endian, unaligned writes

valueputWordhost :: Word -> 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 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.

valueputWord16host :: Word16 -> Builder
#

Write a Word16 in native host order and host endianness. 2 bytes will be written, unaligned.

valueputWord32host :: Word32 -> Builder
#

Write a Word32 in native host order and host endianness. 4 bytes will be written, unaligned.

valueputWord64host :: Word64 -> Builder
#

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.

valueputInt16host :: Int16 -> Builder
#

Write a Int16 in native host order and host endianness. 2 bytes will be written, unaligned.

valueputInt32host :: Int32 -> Builder
#

Write a Int32 in native host order and host endianness. 4 bytes will be written, unaligned.

valueputInt64host :: Int64 -> Builder
#

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