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

Modulecereal-0.5.8.3Haskell2010

Data.Serialize.Put

The Put monad. A monad for efficiently constructing bytestrings.

  • 3 types
  • 45 values
  • Packagecereal-0.5.8.3
  • Exports48
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourcePut.hs

The Put type

10 declarations
typetype Put = PutM ()
#

Put merely lifts Builder into a Writer monad, applied to ().

newtypenewtype PutM a
#

The PutM type. A Writer monad over the efficient Builder monoid.

Constructors

Instances5Monad, Functor, Applicative, Semigroup, Monoid
  • Monad PutMDefined in cereal-0.5.8.3 · Data.Serialize.Put
  • Functor PutMDefined in cereal-0.5.8.3 · Data.Serialize.Put
  • Applicative PutMDefined in cereal-0.5.8.3 · Data.Serialize.Put
  • Semigroup (PutM ())Defined in cereal-0.5.8.3 · Data.Serialize.Put
  • Monoid (PutM ())Defined in cereal-0.5.8.3 · Data.Serialize.Put

Flushing the implicit parse state

1 declaration
valueflush :: Put
#

Pop the ByteString we have constructed so far, if any, yielding a new chunk in the result ByteString.

Primitives

5 declarations

An efficient primitive to write a strict ByteString into the output buffer. It flushes the current buffer, and writes the argument into a new chunk.

Big-endian primitives

6 declarations

Little-endian primitives

6 declarations

Host-endian, unaligned writes

8 declarations
valueputWordhost :: Putter Word
#

O(1). Write 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.

O(1). Write a Word16 in native host order and host endianness. For portability issues see putWordhost.

O(1). Write a Word32 in native host order and host endianness. For portability issues see putWordhost.

O(1). Write a Word64 in native host order On a 32 bit machine we write two host order Word32s, in big endian form. For portability issues see putWordhost.

valueputInthost :: Putter Int
#

O(1). Write a single native machine int. The int 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 int sized machines, without conversion.

O(1). Write a Int16 in native host order and host endianness. For portability issues see putInthost.

O(1). Write a Int32 in native host order and host endianness. For portability issues see putInthost.

O(1). Write a Int64 in native host order On a 32 bit machine we write two host order Int32s, in big endian form. For portability issues see putInthost.

Containers

12 declarations
valueputNested :: Putter Int -> Put -> Put
#

Put a nested structure by first putting a length field and then putting the encoded value.