2 ms·
> X | Y isn't so different from 'a' A | 'b' B Except for the fact that the union of a type with itself (X | X) doesn't add any extra values, while a tagged uni
by nybble41 6y ago
> X | Y isn't so different from 'a' A | 'b' B
Except for the fact that the union of a type with itself (X | X) doesn't add any extra values, while a tagged union can have distinct tags with the same data type ('a' A | 'b' A) and actually sums the possible values for each tag. They are equivalent only so long as the unions are disjoint with no overlap between the members.
- karmakaze 6y agoI think we're saying the same thing. I was saying it's like thinking of 'a' A as an X and 'b' B as a Y.