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

Moduleserialise-0.2.6.1Haskell2010

Codec.Serialise.Encoding

High level API for encoding values, for later serialization into CBOR binary format, using a Monoid based interface.

  • 2 types
  • 31 values
  • Packageserialise-0.2.6.1
  • Exports33
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceEncoding.hs

Encoding implementation

2 declarations
newtypenewtype Encoding
#

An intermediate form used during serialisation, specified as a Monoid. It supports efficient concatenation, and is equivalent to a specialised Endo Tokens type.

It is used for the stage in serialisation where we flatten out the Haskell data structure but it is independent of any specific external binary or text format.

Traditionally, to build any arbitrary Encoding value, you specify larger structures from smaller ones and append the small ones together using mconcat.

Constructors

Instances3Show, Semigroup, Monoid
datadata Tokens
#
Instances2Eq, Show
  • Eq TokensDefined in cborg-0.2.10.0 · Codec.CBOR.Encoding
  • Show TokensDefined in cborg-0.2.10.0 · Codec.CBOR.Encoding

Encoding API for serialisation

31 declarations

Encode a token specifying the beginning of a string of bytes of indefinite length. In reality, this specifies a stream of many occurrences of encodeBytes, each specifying a single chunk of the overall string. After all the bytes desired have been encoded, you should follow it with a break token (see encodeBreak).

valueencodeListLen :: Word -> Encoding
#

Encode the length of a list, used to indicate that the following tokens represent the list values.

Encode a token specifying that this is the beginning of an indefinite list of unknown size. Tokens representing the list are expected afterwords, followed by a break token (see encodeBreak) when the list has ended.

valueencodeMapLen :: Word -> Encoding
#

Encode the length of a Map, used to indicate that the following tokens represent the map values.

Encode a token specifying that this is the beginning of an indefinite map of unknown size. Tokens representing the map are expected afterwords, followed by a break token (see encodeBreak) when the map has ended.

valueencodeBreak :: Encoding
#

Encode a 'break', used to specify the end of indefinite length objects like maps or lists.

valueencodeSimple :: Word8 -> Encoding
#

Encode a 'simple' CBOR token that can be represented with an 8-bit word. You probably don't ever need this.