Data.Argonaut.Encode.Generic.Rep
- Package
- purescript-argonaut-generic
- Repository
- purescript-contrib/purescript-argonaut-generic
#EncodeRep Source
class EncodeRep r whereMembers
Instances
EncodeRep NoConstructors(EncodeRep a, EncodeRep b) => EncodeRep (Sum a b)(IsSymbol name, EncodeRepArgs a) => EncodeRep (Constructor name a)
#EncodeRepArgs Source
class EncodeRepArgs r whereMembers
encodeRepArgs :: r -> Array Json
Instances
EncodeRepArgs NoArguments(EncodeRepArgs a, EncodeRepArgs b) => EncodeRepArgs (Product a b)(RowToList row rl, EncodeRepRowList rl row) => EncodeRepArgs (Argument (Record row))(EncodeJson a) => EncodeRepArgs (Argument a)
#EncodeRepFields Source
class EncodeRepFields r whereMembers
encodeRepFields :: r -> Object Json
Instances
(EncodeRepFields a, EncodeRepFields b) => EncodeRepFields (Product a b)
#EncodeRepRowList Source
class EncodeRepRowList (rl :: RowList) (row :: Row Type) | rl -> row wherea 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
EncodeRepRowList Nil row(EncodeJson ty, IsSymbol name, EncodeRepRowList tail row, Cons name ty ignore row) => EncodeRepRowList (Cons name ty tail) row
#EncodeLiteral Source
class EncodeLiteral r whereMembers
encodeLiteral :: (String -> String) -> r -> Json
Instances
(EncodeLiteral a, EncodeLiteral b) => EncodeLiteral (Sum a b)(IsSymbol name) => EncodeLiteral (Constructor name NoArguments)
#genericEncodeJson Source
genericEncodeJson :: forall r a. Generic a r => EncodeRep r => a -> JsonEncode any Generic data structure into Json.
#encodeLiteralSum Source
encodeLiteralSum :: forall r a. Generic a r => EncodeLiteral r => a -> JsonA function for encoding Generic sum types using string literal representations
#encodeLiteralSumWithTransform Source
encodeLiteralSumWithTransform :: forall r a. Generic a r => EncodeLiteral r => (String -> String) -> a -> JsonA function for encoding Generic sum types using string literal representations
Takes a function for transforming the tag name in encoding