Build the canonical {@functype, _tag, value} envelope OBJECT used by both
the instance toJSON() (which returns it directly so native JSON.stringify
can recurse) and the serialize().toJSON() method (which stringifies it).
_tag is always emitted — variant-less types pass the same string for
marker and tag (default behavior when tag is omitted). Keeping _tag
across the board preserves back-compat for readers that did
if (parsed._tag === "List") against 1.1.0 envelopes.
Parameters
marker: string
The @functype type marker, e.g. "Either", "Option".
tag: string|undefined
The variant discriminator, e.g. "Right", "Some". Defaults
to marker for types without variants (List, Map, etc.).
Build the canonical
{@functype, _tag, value}envelope OBJECT used by both the instancetoJSON()(which returns it directly so native JSON.stringify can recurse) and theserialize().toJSON()method (which stringifies it)._tagis always emitted — variant-less types pass the same string for marker and tag (default behavior when tag is omitted). Keeping_tagacross the board preserves back-compat for readers that didif (parsed._tag === "List")against 1.1.0 envelopes.