Module

Data.Argonaut.Encode.Generic.Rep

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

#EncodeRep Source

class EncodeRep r  where

Members

Instances

#EncodeRepFields Source

#EncodeRepRowList Source

class EncodeRepRowList (rl :: RowList) (row :: Row Type) | rl -> row where

a EncodeRepRowList represents a relation between a RowList and a record you can serialize into a Json Object

this one is strictly internal to help out encodeRepRecordArgument 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 use the Cons cases to to compose functions that adds the field and values from the given record into a Json-Object the field in question is indicated by the head of the RowList

the Nil case just returns identity to bootstrap the composition-chain

Members

Instances

#EncodeLiteral Source

class EncodeLiteral r  where

Members

Instances

#genericEncodeJson Source

genericEncodeJson :: forall r a. Generic a r => EncodeRep r => a -> Json

Encode any Generic data structure into Json.

#encodeLiteralSum Source

encodeLiteralSum :: forall r a. Generic a r => EncodeLiteral r => a -> Json

A function for encoding Generic sum types using string literal representations

#encodeLiteralSumWithTransform Source

encodeLiteralSumWithTransform :: forall r a. Generic a r => EncodeLiteral r => (String -> String) -> a -> Json

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