Module
Codec.Json.JsonDecoder
- Package
- purescript-json-codecs
- Repository
- jordanmartinez/purescript-json-codecs
#JsonDecoder Source
type JsonDecoder e extra a = DecoderFn (Array JsonOffset) (JsonErrorHandlers e) e extra Json a
Same as JsonDecoder'
but the from
type variable is hard-coded to Json
.
#JsonDecoder' Source
type JsonDecoder' e extra from to = DecoderFn (Array JsonOffset) (JsonErrorHandlers e) e extra from to
#addOffset Source
addOffset :: forall e extra from a. JsonOffset -> Json -> JsonDecoder' e extra Json a -> JsonDecoder' e extra from a
#onError Source
onError :: forall e extra from a. (Array JsonOffset -> e -> e) -> JsonDecoder' e extra from a -> JsonDecoder' e extra from a
#failWithMissingField Source
failWithMissingField :: forall e extra from a. String -> JsonDecoder' e extra from a
#failWithMissingIndex Source
failWithMissingIndex :: forall e extra from a. Int -> JsonDecoder' e extra from a
#failWithUnrefinableValue Source
failWithUnrefinableValue :: forall e extra from a. String -> JsonDecoder' e extra from a
#failWithStructureError Source
failWithStructureError :: forall e extra from a. String -> JsonDecoder' e extra from a
#addTypeHintD Source
addTypeHintD :: forall e extra from a. String -> JsonDecoder' e extra from a -> JsonDecoder' e extra from a
#addCtorHintD Source
addCtorHintD :: forall e extra from a. String -> JsonDecoder' e extra from a -> JsonDecoder' e extra from a
#addSubtermHintD Source
addSubtermHintD :: forall e extra from a. Int -> JsonDecoder' e extra from a -> JsonDecoder' e extra from a
#addFieldHintD Source
addFieldHintD :: forall e extra from a. String -> JsonDecoder' e extra from a -> JsonDecoder' e extra from a
#DecodeErrorAccumulatorFn Source
type DecodeErrorAccumulatorFn e extra from to = JsonDecoder' e extra from to -> JsonDecoder' e extra from to -> JsonDecoder' e extra from to
A function that determines how to accumulate errors (if any)
altAccumulate
altLast
#altAccumulate Source
altAccumulate :: forall e extra from a. DecodeErrorAccumulatorFn e extra from a
Works like alt
/<|>
. Decodes using the first decoder and, if that fails,
decodes using the second decoder. Errors from both decoders accumulate.
#altLast Source
altLast :: forall e extra from a. DecodeErrorAccumulatorFn e extra from a
Same as altAccumulate
except only the last error is kept. Helpful in cases
where one is decoding a sum type with a large number of data constructors.
#runJsonDecoder Source
runJsonDecoder :: forall e extra a. JsonErrorHandlers e -> (e -> e -> e) -> extra -> Json -> JsonDecoder e extra a -> Either e a
- Modules
- Codec.
Codec - Codec.
Decoder - Codec.
Decoder. Qualified - Codec.
Json. Bidirectional. Class - Codec.
Json. Bidirectional. Value - Codec.
Json. Errors. AnsiDodoError - Codec.
Json. Errors. DecodeMessages - Codec.
Json. Errors. NoError - Codec.
Json. Errors. PlainDodoError - Codec.
Json. Errors. PrimitiveJsonError - Codec.
Json. Errors. Tree - Codec.
Json. JsonCodec - Codec.
Json. JsonDecoder - Codec.
Json. Newtypes - Codec.
Json. Types - Codec.
Json. Unidirectional. Decode. Class - Codec.
Json. Unidirectional. Decode. Value - Codec.
Json. Unidirectional. Encode. Class - Codec.
Json. Unidirectional. Encode. Value - Data.
V. Semigroup. Qualified