Idris2Doc : JSON.Encoder

JSON.Encoder

(source)
The interfaces in this module abstract over how we
encode and decode values from and to JSON.

This allows us to use different (probably backend dependant)
intermediary data representations to be used by the actual
marshallers `ToJSON` and `FromJSON`.

Reexports

importpublic JSON.Parser

Definitions

interfaceEncoder : Type->Type
  Abstraction over JSON value encoding.

Parameters: v
Methods:
stringify : v->String
  Converts the intermediary data representation
to a JSON string.
string : String->v
  Encodes a `String` value.
double : Double->v
  Encodes a `Double` as a JSON `Double`.
integer : Integer->v
  Encodes a `Double` as a JSON `Integer`.
boolean : Bool->v
  Encodes a `Bool` as a JSON `Boolean`.
array : Listv->v
  Encodes a `List` of values as a JSON `Array`.
object : List (String, v) ->v
  Encodes a `List` key-value pairs as a JSON `Object`
null : v

Implementation: 
EncoderJSON
stringify : Encoderv=>v->String
  Converts the intermediary data representation
to a JSON string.

Visibility: public export
string : Encoderv=>String->v
  Encodes a `String` value.

Visibility: public export
double : Encoderv=>Double->v
  Encodes a `Double` as a JSON `Double`.

Visibility: public export
integer : Encoderv=>Integer->v
  Encodes a `Double` as a JSON `Integer`.

Visibility: public export
boolean : Encoderv=>Bool->v
  Encodes a `Bool` as a JSON `Boolean`.

Visibility: public export
array : Encoderv=>Listv->v
  Encodes a `List` of values as a JSON `Array`.

Visibility: public export
object : Encoderv=>List (String, v) ->v
  Encodes a `List` key-value pairs as a JSON `Object`

Visibility: public export
null : Encoderv=>v
Visibility: public export
interfaceObject : Type->Type->Type
  Abstraction over JSON Object representation for decoding.
It is important that `obj` is the type that guides interface
resolution here, otherwise operators like `.:` cannot conveniently
be used, since Idris needs additional guidance to resolve interfaces.

Parameters: obj, v
Methods:
lookup : String->obj->Maybev
pairs : obj->List (String, v)

Implementation: 
Object (List (String, JSON)) JSON
lookup : Objectobjv=>String->obj->Maybev
Visibility: public export
pairs : Objectobjv=>obj->List (String, v)
Visibility: public export
interfaceValue : Type->Type->Type
  Abstraction over JSON value representation for decoding.

Parameters: v, obj
Constraints: Object obj v
Methods:
typeOf : v->String
  Returns the actual value. This should be one of
"String", "Null", "Object", "Number", "Boolean", or "Array".
However, other types are possible as well, as this is
only used for error messages when something goes wrong.
parse : Origin->String->Either (ParseErrorVoid) v
  Tries to convert a string to an intermediare value.
getObject : v->Maybeobj
  Tries to convert a value to an `Object`.
getArray : v->Maybe (Listv)
  Tries to convert a value to an `Array` of values.
getBoolean : v->MaybeBool
  Tries to convert a value to a `Boolean`.
getDouble : v->MaybeDouble
  Tries to convert a value to a `Double`.
getInteger : v->MaybeInteger
  Tries to convert a value to an `Integer`.
getString : v->MaybeString
  Tries to convert a value to a `String`.
isNull : v->Bool
  `True`, if the value in question is `null`.

Implementation: 
ValueJSON (List (String, JSON))
typeOf : Valuevobj=>v->String
  Returns the actual value. This should be one of
"String", "Null", "Object", "Number", "Boolean", or "Array".
However, other types are possible as well, as this is
only used for error messages when something goes wrong.

Visibility: public export
parse : Valuevobj=>Origin->String->Either (ParseErrorVoid) v
  Tries to convert a string to an intermediare value.

Visibility: public export
getObject : Valuevobj=>v->Maybeobj
  Tries to convert a value to an `Object`.

Visibility: public export
getArray : Valuevobj=>v->Maybe (Listv)
  Tries to convert a value to an `Array` of values.

Visibility: public export
getBoolean : Valuevobj=>v->MaybeBool
  Tries to convert a value to a `Boolean`.

Visibility: public export
getDouble : Valuevobj=>v->MaybeDouble
  Tries to convert a value to a `Double`.

Visibility: public export
getInteger : Valuevobj=>v->MaybeInteger
  Tries to convert a value to an `Integer`.

Visibility: public export
getString : Valuevobj=>v->MaybeString
  Tries to convert a value to a `String`.

Visibility: public export
isNull : Valuevobj=>v->Bool
  `True`, if the value in question is `null`.

Visibility: public export
getArrayN : Valuevobj=> (n : Nat) ->v->Maybe (Vectnv)
Visibility: public export