Idris2Doc : JSON.FromJSON

JSON.FromJSON

(source)
Interface and utilities for marshalling Idris2 values from JSON
via an intermediate `Value` representation.

For regular algebraic data types, implementations can automatically
be derived using elaborator reflection.

Operators and functionality strongly influenced by Haskell's aeson
library

Definitions

dataJSONPathElement : Type
Totality: total
Visibility: public export
Constructors:
Key : String->JSONPathElement
Index : Bits32->JSONPathElement

Hints:
EqJSONPathElement
GenericJSONPathElement [[String], [Bits32]]
MetaJSONPathElement [[String], [Bits32]]
ShowJSONPathElement
JSONPath : Type
Visibility: public export
JSONErr : Type
Visibility: public export
Result : Type->Type
Visibility: public export
Parser : Type->Type->Type
Visibility: public export
orElse : Eitherab-> Lazy (Eitherab) ->Eitherab
Visibility: public export
dataDecodingErr : Type
Totality: total
Visibility: public export
Constructors:
JErr : JSONErr->DecodingErr
JParseErr : ParseErr->DecodingErr

Hints:
EqDecodingErr
GenericDecodingErr [[JSONErr], [ParseErr]]
MetaDecodingErr [[JSONErr], [ParseErr]]
ShowDecodingErr
DecodingResult : Type->Type
Visibility: public export
formatRelativePath : JSONPath->String
  Format a <http://goessner.net/articles/JsonPath/ JSONPath> as a 'String'
which represents the path relative to some root object.

Visibility: export
formatPath : JSONPath->String
  Format a <http://goessner.net/articles/JsonPath/ JSONPath> as a 'String',
representing the root object as @$@.

Visibility: export
formatError : JSONPath->String->String
  Annotate an error message with a
<http://goessner.net/articles/JsonPath/ JSONPath> error location.

Visibility: export
prettyErr : String->DecodingErr->String
  Pretty prints a decoding error. In case of a parsing error,
this might be printed on several lines.

Visibility: export
interfaceFromJSON : Type->Type
Parameters: a
Constructor: MkFromJSON
Methods:
fromJSON : Valuevobj=>Parserva

Implementations:
FromJSONVoid
FromJSON ()
FromJSONBool
FromJSONDouble
FromJSONBits8
FromJSONBits16
FromJSONBits32
FromJSONBits64
FromJSONInt
FromJSONInt8
FromJSONInt16
FromJSONInt32
FromJSONInt64
FromJSONNat
FromJSONInteger
FromJSONString
FromJSONChar
FromJSONa=>FromJSON (Maybea)
FromJSONa=>FromJSON (Lista)
FromJSONa=>FromJSON (List1a)
FromJSONa=>FromJSON (Vectna)
(FromJSONa, FromJSONb) =>FromJSON (Eitherab)
NP (FromJSON.f) ks=>FromJSON (NPfks)
(FromJSONa, FromJSONb) =>FromJSON (a, b)
NP (FromJSON.f) ks=>FromJSON (NSfks)
fromJSON : FromJSONa=>Valuevobj=>Parserva
Visibility: public export
decodeVia : (0v : Type) ->Valuevobj=>FromJSONa=>String->DecodingResulta
Visibility: export
decodeEitherVia : (0v : Type) ->Valuevobj=>FromJSONa=>String->EitherStringa
Visibility: export
decodeMaybeVia : (0v : Type) ->Valuevobj=>FromJSONa=>String->Maybea
Visibility: export
decode : FromJSONa=>String->DecodingResulta
Visibility: export
decodeEither : FromJSONa=>String->EitherStringa
Visibility: export
decodeMaybe : FromJSONa=>String->Maybea
Visibility: export
fail : String->Resulta
Visibility: export
modifyFailure : (String->String) ->Resulta->Resulta
Visibility: export
prependFailure : String->Resulta->Resulta
  If the inner 'Parser' failed, prepend the given string to the failure
message.

Visibility: export
prependContext : String->Resulta->Resulta
Visibility: export
(<?>) : Resulta->JSONPathElement->Resulta
Visibility: export
Fixity Declaration: infixr operator, level 3
withObject : Valuevobj=> Lazy String->Parserobja->Parserva
Visibility: export
withBoolean : Valuevobj=> Lazy String->ParserBoola->Parserva
Visibility: export
withString : Valuevobj=> Lazy String->ParserStringa->Parserva
Visibility: export
withNumber : Valuevobj=> Lazy String->ParserDoublea->Parserva
Visibility: export
withInteger : Valuevobj=> Lazy String->ParserIntegera->Parserva
Visibility: export
withLargeInteger : Valuevobj=> Lazy String->ParserIntegera->Parserva
Visibility: export
boundedIntegral : Numa=>Valuevobj=> Lazy String->Integer->Integer->Parserva
Visibility: export
boundedLargeIntegral : Numa=>Valuevobj=> Lazy String->Integer->Integer->Parserva
Visibility: export
withArray : Valuevobj=> Lazy String->Parser (Listv) a->Parserva
Visibility: export
explicitParseField : Objectobjv=>Valuevobj=>Parserva->obj->ParserStringa
  See `.:`

Visibility: export
explicitParseFieldMaybe : Objectobjv=>Valuevobj=>Parserva->obj->ParserString (Maybea)
  See `.:?`

Visibility: export
explicitParseFieldMaybe' : Objectobjv=>Valuevobj=>Parserva->obj->ParserString (Maybea)
  See `.:!`

Visibility: export
(.:) : Objectobjv=>Valuevobj=>FromJSONa=>obj->ParserStringa
  Retrieve the value associated with the given key of an `IObject`.
The result is `empty` if the key is not present or the value cannot
be converted to the desired type.

This accessor is appropriate if the key and value /must/ be present
in an object for it to be valid. If the key and value are
optional, use `.:?` instead.

Visibility: export
Fixity Declaration: infixr operator, level 9
(.:?) : Objectobjv=>Valuevobj=>FromJSONa=>obj->ParserString (Maybea)
  Retrieve the value associated with the given key of an `IObject`. The
result is `Nothing` if the key is not present or if its value is `Null`,
or `empty` if the value cannot be converted to the desired type.

This accessor is most useful if the key and value can be absent
from an object without affecting its validity. If the key and
value are mandatory, use `.:` instead.

Visibility: export
Fixity Declaration: infixr operator, level 3
(.:!) : Objectobjv=>Valuevobj=>FromJSONa=>obj->ParserString (Maybea)
  Retrieve the value associated with the given key of an `IObject`
The result is `Nothing` if the key is not present or 'empty' if the
value cannot be converted to the desired type.

This differs from `.:?` by attempting to parse `Null` the same as any
other JSON value, instead of interpreting it as `Nothing`.

Visibility: export
Fixity Declaration: infixr operator, level 3
parseField : Objectobjv=>Valuevobj=>FromJSONa=>obj->ParserStringa
  Function variant of `.:`.

Visibility: export
parseFieldMaybe : Objectobjv=>Valuevobj=>FromJSONa=>obj->ParserString (Maybea)
  Function variant of `.:?`.

Visibility: export
parseFieldMaybe' : Objectobjv=>Valuevobj=>FromJSONa=>obj->ParserString (Maybea)
  Function variant of `.:!`.

Visibility: export
sopNewtype : Valuevobj=>FromJSON (fk) =>Parserv (SOPf [[k]])
  Decodes a newtype-like sum of products
(exactly one single value constructor) by wrapping
the decoded value in `MkSOP . Z`.

Visibility: export
sopEnum : Valuevobj=>TypeInfo'kkss-> {auto0_ : EnumTypekss} ->Parserv (SOPfkss)
  Decodes an enum-like sum of products
(only nullary constructors) by trying to extract one of the
constructors' name

Visibility: export
sopRecord : Valuevobj=>NP (FromJSON.f) ks=>TypeInfo [ks] ->Parserv (SOPf [ks])
  Decodes a single-constructor sum of products. The
constructor's name is ignored.

Visibility: export
sop : Valuevobj=>POP (FromJSON.f) kss=>SumEncoding->TypeInfo'kkss->Parserv (SOP_kfkss)
  Decodes a sum of products as specified by the passed
`SumEncoding` (see its documentation for details) using
the given `TypeInfo` to decode constructor and argument names.

See also `sopRecord` for decoding values with a single constructor,
`sopEnum` for decoding enum types (only nullary constructors),
and `sopNewtype` for decoding newtype wrappers.

Visibility: export
genNewtypeFromJSON : Valuevobj=>Generica [[k]] =>FromJSONk=>Parserva
  Generic version of `sopNewtype`.

Visibility: export
genEnumFromJSON : Valuevobj=>Metaakss=> {auto0_ : EnumTypekss} ->Parserva
  Generic version of `sopEnum`.

Visibility: export
genEnumFromJSON' : Valuevobj=>Metaakss=> {auto0_ : EnumTypekss} -> (String->String) ->Parserva
  Like `genEnumFromJSON`, but uses the given function to adjust
constructor names before being used as tags.

Visibility: export
genRecordFromJSON : Valuevobj=>Metaa [ks] =>NPFromJSONks=>Parserva
  Generic version of `sopRecord`.

Visibility: export
genRecordFromJSON' : Valuevobj=>Metaa [ks] =>NPFromJSONks=> (String->String) ->Parserva
  Like `genRecordFromJSON`, but uses the given function to adjust
field names before being used as tags.

Visibility: export
genFromJSON : Valuevobj=>Metaacode=>POPFromJSONcode=>SumEncoding->Parserva
Visibility: export
genFromJSON' : Valuevobj=>Metaacode=>POPFromJSONcode=> (String->String) -> (String->String) ->SumEncoding->Parserva
Visibility: export
customFromJSON : TTImp->DeriveUtil->InterfaceImpl
Visibility: export
FromJSON : DeriveUtil->InterfaceImpl
  Derives a `FromJSON` implementation for the given data type

Visibility: export
RecordFromJSON : DeriveUtil->InterfaceImpl
  Derives a `FromJSON` implementation for the given single-constructor
data type

Visibility: export
EnumFromJSON : DeriveUtil->InterfaceImpl
  Derives a `FromJSON` implementation for the given enum type

Visibility: export
NewtypeFromJSON : DeriveUtil->InterfaceImpl
  Derives a `FromJSON` implementation for the given newtype

Visibility: export