3 ms·
> `Either` is a generic variant record, it should not be used to carry errors. The name suggests that, but the Monad instance suggests that Either is an asymme
by nemetroid 9y ago
> `Either` is a generic variant record, it should not be used to carry errors.
The name suggests that, but the Monad instance suggests that Either is an asymmetric data type, where the left and right branches carry different meaning.
> And as a general rule, any programming construct that relies on convention instead of static typing is prone to generating bugs.
If the Either branches were named `Error` and `Success`, using `Error` to carry errors would be just as much of a convention as using `Left` for that purpose (a more sensible convention, but nonetheless a convention). The only way you'd get around that is if you'd somehow encode in the language what is and what isn't an error and use that to statically force correct branch usage.