Module

Data.Argonaut.Decode.Generic.Rep

Package
purescript-argonaut-generic
Repository
purescript-contrib/purescript-argonaut-generic

#DecodeRep Source

class DecodeRep r  where

Members

Instances

#DecodeRepArgs Source

#DecodeRepRowList Source

class DecodeRepRowList (rl :: RowList) (from :: Row Type) (to :: Row Type) | rl -> from to where

a DecodeRepRowList represents a relation between a RowList and a record you can build from it by deserializing it's fields from a JSON Object

this one is strictly internal to help out decodeRepRecordArgument handling records

a RowList on the type level is very similar to a cons-list on the value level so the two instances handle all possible RowLists

the idea is to use Builder to convert a RowList into a record at the type-level and have decodeRepRowList as witness on the value level that will try to decode JSON in to the resulting record value

from and to are two helper types - using these decodeRepRowListCons can recursively create Builder-steps and make sure that every symbol in rl can only occur once (the fields in the records must be unique) (see Row.Lacks)

Members

Instances

#DecodeLiteral Source

#genericDecodeJson Source

genericDecodeJson :: forall r a. Generic a r => DecodeRep r => Json -> Either String a

Decode Json representation of a value which has a Generic type.

#decodeLiteralSum Source

decodeLiteralSum :: forall r a. Generic a r => DecodeLiteral r => Json -> Either String a

A function for decoding Generic sum types using string literal representations

#decodeLiteralSumWithTransform Source

decodeLiteralSumWithTransform :: forall r a. Generic a r => DecodeLiteral r => (String -> String) -> Json -> Either String a

A function for decoding Generic sum types using string literal representations Takes a function for transforming the tag name in encoding