5 ms·
I find unions without a tag hard to handle. To expand on another commenters example, suppose you have a sum type that models successful computation with a retu
by eru 6y ago
I find unions without a tag hard to handle.
To expand on another commenters example, suppose you have a sum type that models successful computation with a return value or a failure with an error message.
If you have tags / constructors, that's all easy. But if you just use naked unions, you can not write code that deals with error messages (or strings in general) in the success case.