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

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 77a8662 · 2026-10-31

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.

Contents
  1. Encoding implementation
  2. Encoding API for serialisation
Synopsis
  • Packageserialise-0.2.6.1
  • Exports33
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceEncoding.hs

Encoding implementation

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

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).

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.

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.

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