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

Modulecborg-0.2.10.0Haskell2010

Codec.CBOR.Term

This module provides an interface for decoding and encoding arbitrary CBOR values (ones that, for example, may not have been generated by this library).

Using decodeTerm, you can decode an arbitrary CBOR value given to you into a Term, which represents a CBOR value as an AST.

Similarly, if you wanted to encode some value into a CBOR value directly, you can wrap it in a Term constructor and use encodeTerm. This would be useful, as an example, if you needed to serialise some value into a CBOR term that is not compatible with that types Serialise instance.

Because this interface gives you the ability to decode or encode any arbitrary CBOR term, it can also be seen as an alternative interface to the Codec.CBOR.Encoding and Codec.CBOR.Decoding modules.

  • 1 type
  • 2 values
  • Packagecborg-0.2.10.0
  • Exports3
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceTerm.hs
datadata Term
#

A general CBOR term, which can be used to serialise or deserialise arbitrary CBOR terms for interoperability or debugging. This type is essentially a direct reflection of the CBOR abstract syntax tree as a Haskell data type.

The Term type also comes with a Serialise instance, so you can easily use decode :: Decoder Term to directly decode any arbitrary CBOR value into Haskell with ease, and likewise with encode.

Instances4Eq, Ord, Read, Show
  • Eq TermDefined in cborg-0.2.10.0 · Codec.CBOR.Term
  • Ord TermDefined in cborg-0.2.10.0 · Codec.CBOR.Term
  • Read TermDefined in cborg-0.2.10.0 · Codec.CBOR.Term
  • Show TermDefined in cborg-0.2.10.0 · Codec.CBOR.Term