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 |
A simpler form than CBOR for writing out
values that allows
easier verification and testing. While this library primarily focuses
on taking Encoding
values (independent of any underlying format)
and serializing them into CBOR format, this module offers an alternative
format called Encoding
for serializing FlatTerm
values.Encoding
The
form is very simple and internally mirrors the original
FlatTerm
type very carefully. The intention here is that once you
have Encoding
and Encoding
values for your types, you can
round-trip values through Decoding
to catch bugs more easily and with
a smaller amount of code to look through.FlatTerm
For that reason, this module is primarily useful for client libraries, and even then, only for their test suites to offer a simpler form for doing encoding tests and catching problems in an encoder and decoder.
Synopsis
- type FlatTerm = [TermToken]
- data TermToken
- toFlatTerm :: Encoding -> FlatTerm
- fromFlatTerm :: (forall s. Decoder s a) -> FlatTerm -> Either String a
- validFlatTerm :: FlatTerm -> Bool
Types
type FlatTerm = [TermToken] Source #
A "flat" representation of an
value,
useful for round-tripping and writing tests.Encoding
Since: cborg-0.2.0.0
A concrete encoding of
values, one
which mirrors the original Encoding
type closely.Encoding
Since: cborg-0.2.0.0