purescript-codec-argonaut
purescript-codec-argonaut copied to clipboard
variantMatch function -> don't use either to differentiate between parsers and nullary constructors
In docs
The fields in the record passed to CAV.variantMatch correspond with the variant constructors. Each one accepts an Either carrying either a codec or a static value - Right with a codec for when there's a value that needs encoding for the constructor, Left with a static value for nullary constructors.
It's better to make it accept
data VariantMatchCodecType a b = Codec a | Nullary b
Why's that? Also, the instructor
variable is undefined here, and I'm not sure what the b
is for either.
Also, the instructor variable is undefined here
oh, sorry, typo, updated
Why's that?
it's the same as Either, but more descriptive
Codec is better than Left, Nullary is better than Right