Tagged union (source code)

= Tagged union
{title2=$A+B$}
{wiki}

= Sum type
{synonym}

A <data type> whose values belong to one of several alternatives, with a logical tag distinguishing the chosen alternative. If `Number n` and `Operator op` are its constructors, <pattern matching> can distinguish the variants even if their payloads use similar representations. The tag need not occupy a separate physical memory field in every implementation.