Idris2Doc : Language.JSON.Interfaces

Language.JSON.Interfaces

(source)
Interfaces for converting values from/to JSON.

(C) The Idris Community, 2021

Definitions

interfaceToJSON : Type->Type
  A type that can be converted to JSON.
An example type and implementation is:
```idris example
record Position where
constructor MkPosition
x : Integer
y : Integer

ToJSON Position where
toJSON pos = JObject [("x", toJSON pos.x), ("y", toJSON pos.y)]
```

Parameters: a
Methods:
toJSON : a->JSON

Implementations:
ToJSONJSON
ToJSONInteger
ToJSONInt
ToJSONBits8
ToJSONBits16
ToJSONBits32
ToJSONBits64
ToJSONDouble
ToJSONNat
ToJSONString
ToJSONChar
ToJSONBool
ToJSONa=>ToJSON (Maybea)
ToJSONa=>ToJSON (Lista)
ToJSON ()
(ToJSONa, ToJSONb) =>ToJSON (a, b)
ToJSONv=>ToJSON (SortedMapStringv)
ToJSONa=>ToJSON (Inf a)
toJSON : ToJSONa=>a->JSON
Totality: total
Visibility: public export
interfaceFromJSON : Type->Type
  A type that can be possibly converted from JSON.
An example type and implementation is:
```idris example
record Position where
constructor MkPosition
x : Integer
y : Integer

FromJSON Position where
fromJSON (JObject arg) = do
x <- lookup "x" arg >>= fromJSON
y <- lookup "y" arg >>= fromJSON
pure $ MkPosition x y
fromJSON _ = neutral
```

Parameters: a
Methods:
fromJSON : JSON->Maybea

Implementations:
FromJSONJSON
FromJSONInteger
FromJSONInt
FromJSONBits8
FromJSONBits16
FromJSONBits32
FromJSONBits64
FromJSONDouble
FromJSONNat
FromJSONString
FromJSONChar
FromJSONBool
FromJSONa=>FromJSON (Maybea)
FromJSONa=>FromJSON (Lista)
FromJSON ()
(FromJSONa, FromJSONb) =>FromJSON (a, b)
FromJSONv=>FromJSON (SortedMapStringv)
FromJSONa=>FromJSON (Inf a)
fromJSON : FromJSONa=>JSON->Maybea
Totality: total
Visibility: public export