Copyright | (c) Duncan Coutts 2015-2017 |
---|---|
License | BSD3-style (see LICENSE.txt) |
Maintainer | duncan@community.haskell.org |
Stability | experimental |
Portability | non-portable (GHC extensions) |
Safe Haskell | None |
Language | Haskell2010 |
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
, you can decode an arbitrary CBOR value given to you
into a decodeTerm
, which represents a CBOR value as an AST.Term
Similarly, if you wanted to encode some value into a CBOR value directly,
you can wrap it in a
constructor and use Term
. 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 encodeTerm
instance.Serialise
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
and
Encoding
modules.Decoding
- data Term
- encodeTerm :: Term -> Encoding
- decodeTerm :: Decoder s Term
Documentation
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
type also comes with a Term
instance, so you can
easily use Serialise
to directly decode any arbitrary
CBOR value into Haskell with ease, and likewise with decode
:: Decoder
Term
.encode
Since: 0.2.0.0
encodeTerm :: Term -> Encoding Source #