Module
Codec.Json.JsonCodec
- Package
- purescript-json-codecs
- Repository
- jordanmartinez/purescript-json-codecs
#JsonCodec Source
type JsonCodec e extra a = JsonCodec' e extra Json a
Overview of values:
- e - the custom Json decoding error
- extra - top-down custom data one may need for writing a codec. This is where
local overrides for typeclass instances can be provided.
If this value isn't needed, you should set this to
Unit
. - a - decode Json to a value of this type or encode it to Json
#JsonCodec' Source
type JsonCodec' e extra from to = Codec' (Array JsonOffset) (JsonErrorHandlers e) e extra from to
#JIndexedCodec Source
type JIndexedCodec e extra a = Codec (Array JsonOffset) (JsonErrorHandlers e) e extra (Array Json) (List Json) a a
#JPropCodec Source
type JPropCodec e extra a = Codec (Array JsonOffset) (JsonErrorHandlers e) e extra (Object Json) (List (Tuple String Json)) a a
#mkJsonCodec Source
mkJsonCodec :: forall e extra a. JsonDecoder e extra a -> (a -> Json) -> JsonCodec e extra a
#decode Source
decode :: forall e extra a. JsonErrorHandlers e -> (e -> e -> e) -> extra -> Json -> JsonCodec e extra a -> Either e a
#addTypeHintC Source
addTypeHintC :: forall e extra a b c d. String -> Codec (Array JsonOffset) (JsonErrorHandlers e) e extra a b c d -> Codec (Array JsonOffset) (JsonErrorHandlers e) e extra a b c d
#addCtorHintC Source
addCtorHintC :: forall e extra a b c d. String -> Codec (Array JsonOffset) (JsonErrorHandlers e) e extra a b c d -> Codec (Array JsonOffset) (JsonErrorHandlers e) e extra a b c d
#addSubtermHintC Source
addSubtermHintC :: forall e extra a b c d. Int -> Codec (Array JsonOffset) (JsonErrorHandlers e) e extra a b c d -> Codec (Array JsonOffset) (JsonErrorHandlers e) e extra a b c d
#addFieldHintC Source
addFieldHintC :: forall e extra a b c d. String -> Codec (Array JsonOffset) (JsonErrorHandlers e) e extra a b c d -> Codec (Array JsonOffset) (JsonErrorHandlers e) e extra a b c d
#refinedValue Source
refinedValue :: forall decodeError extra decodeFromEncodeTo decodeToEncodeFrom. (decodeFromEncodeTo -> Either String decodeToEncodeFrom) -> (decodeToEncodeFrom -> decodeFromEncodeTo) -> JsonCodec' decodeError extra decodeFromEncodeTo decodeToEncodeFrom
import Data.String.NonEmpty as NES
string >~> refinedValue (note "Received empty string" <<< NES.fromString) (NES.toString)
- 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