Module

Data.Codec.Argonaut.Record

#object

object :: forall ri ro rl. RowToList ri rl => RowListCodec rl ri ro => String -> Record ri -> JsonCodec (Record ro)

Constructs a JsonCodec for a Record from a name and a record of codecs. The name is used in the error message produced when decoding fails.

type Person = { name ∷ String, age ∷ Int }

personCodec ∷ CA.JsonCodec Person
personCodec = CAR.object "Person" { name: CA.string, age: CA.int }

#record

record :: forall ri ro rl. RowToList ri rl => RowListCodec rl ri ro => Record ri -> JPropCodec (Record ro)

Constructs a JPropCodec for a Record from a record of codecs. Commonly the object function in this module will be the preferred choice, as that produces a JsonCodec instead.

#RowListCodec

class RowListCodec (rl :: RowList Type) (ri :: Row Type) (ro :: Row Type) | rl -> ri ro where

The class used to enable the building of Record codecs by providing a record of codecs.

Members

Instances

Modules