3 ms·
They're not nearly as good as as an Either type, but if you don't have do notation, exceptions are much, much, easier to use than sum types for error handling.
by beojan 9y ago
They're not nearly as good as as an Either type, but if you don't have do notation, exceptions are much, much, easier to use than sum types for error handling.
- np_tedious 9y agoYep. If you want to be really broad, even golong's (val, err) is a sum type even tho tuples are more literally product types. Since it's generally one or the other that has meaningful value, not both. But it sure as hell isn't easy since there is no do syntax or flatMap/selectMany/whatever to handle them nicely.