A tagged union that can hold a single value from any of a specified set of
types.
The value in a SumType can be operated on using pattern matching.
To avoid ambiguity, duplicate types are not allowed (but see the
"basic usage" example for a workaround).
The special type This can be used as a placeholder to create
self-referential types, just like with Algebraic. See the
"Arithmetic expression evaluator" example for
usage.
A SumType is initialized by default to hold the .init value of its
first member type, just like a regular union. The version identifier
SumTypeNoDefaultCtor can be used to disable this behavior.
A tagged union that can hold a single value from any of a specified set of types.
The value in a SumType can be operated on using pattern matching.
To avoid ambiguity, duplicate types are not allowed (but see the "basic usage" example for a workaround).
The special type This can be used as a placeholder to create self-referential types, just like with Algebraic. See the "Arithmetic expression evaluator" example for usage.
A SumType is initialized by default to hold the .init value of its first member type, just like a regular union. The version identifier SumTypeNoDefaultCtor can be used to disable this behavior.