Module
Data.Codec.Argonaut.Sum
- Package
- purescript-codec-argonaut
- Repository
- garyb/purescript-codec-argonaut
#taggedSum Source
taggedSum :: forall a. (Tag -> Json -> Either JsonDecodeError a) -> (a -> Tuple Tag Json) -> JsonCodec a
A helper for defining JSON codecs for sum types.
- The first function attempts to decode a case, using the specified tag.
- The second function encodes a case, returning an appropriate tag and encoded value.