cborg-0.2.1.0: Concise Binary Object Representation

Codec.CBOR.Encoding

Description

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

Synopsis

# Encoding implementation

newtype Encoding Source #

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.

Since: cborg-0.2.0.0

Constructors

 Encoding (Tokens -> Tokens)
Instances
 Source # Instance detailsDefined in Codec.CBOR.Encoding MethodsshowList :: [Encoding] -> ShowS # Source # Since: cborg-0.2.0.0 Instance detailsDefined in Codec.CBOR.Encoding Methodsstimes :: Integral b => b -> Encoding -> Encoding # Source # Since: cborg-0.2.0.0 Instance detailsDefined in Codec.CBOR.Encoding Methodsmconcat :: [Encoding] -> Encoding #

data Tokens Source #

A flattened representation of a term, which is independent of any underlying binary representation, but which we later serialise into CBOR format.

Since: cborg-0.2.0.0

Instances
 Source # Instance detailsDefined in Codec.CBOR.Encoding Methods(==) :: Tokens -> Tokens -> Bool #(/=) :: Tokens -> Tokens -> Bool # Source # Instance detailsDefined in Codec.CBOR.Encoding MethodsshowsPrec :: Int -> Tokens -> ShowS #showList :: [Tokens] -> ShowS #

# Encoding API for serialisation

Encode a Word in a flattened format.

Since: cborg-0.2.0.0

Encode a Word8 in a flattened format.

Since: cborg-0.2.0.0

Encode a Word16 in a flattened format.

Since: cborg-0.2.0.0

Encode a Word32 in a flattened format.

Since: cborg-0.2.0.0

Encode a Word64 in a flattened format.

Since: cborg-0.2.0.0

Encode an Int in a flattened format.

Since: cborg-0.2.0.0

Encode an Int8 in a flattened format.

Since: cborg-0.2.0.0

Encode an Int16 in a flattened format.

Since: cborg-0.2.0.0

Encode an Int32 in a flattened format.

Since: cborg-0.2.0.0

Encode an @Int64 in a flattened format.

Since: cborg-0.2.0.0

Encode an arbitrarily large @Integer in a flattened format.

Since: cborg-0.2.0.0

Encode an arbitrary strict ByteString in a flattened format.

Since: cborg-0.2.0.0

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

Since: cborg-0.2.0.0

Encode a bytestring in a flattened format.

Since: cborg-0.2.0.0

Encode a Text in a flattened format.

Since: cborg-0.2.0.0

Encode the beginning of an indefinite string.

Since: cborg-0.2.0.0

Encode a UTF-8 string in a flattened format. Note that the contents is not validated to be well-formed UTF-8.

Since: cborg-0.2.0.0

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

Since: cborg-0.2.0.0

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.

Since: cborg-0.2.0.0

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

Since: cborg-0.2.0.0

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.

Since: cborg-0.2.0.0

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

Since: cborg-0.2.0.0

Encode an arbitrary Word tag.

Since: cborg-0.2.0.0

Encode an arbitrary 64-bit Word64 tag.

Since: cborg-0.2.0.0

Encode a Bool.

Since: cborg-0.2.0.0

Encode an Undef value.

Since: cborg-0.2.0.0

Encode a Null value.

Since: cborg-0.2.0.0

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

Since: cborg-0.2.0.0

Encode a small 16-bit Float in a flattened format.

Since: cborg-0.2.0.0

Encode a full precision Float in a flattened format.

Since: cborg-0.2.0.0

Encode a Double in a flattened format.

Since: cborg-0.2.0.0