4 ms·
The types are definitely isomorphic, but the difference between them is not "pointless". You could have Either<IOError, Either<IOError, Result>> and want to pre
by 0815test 7y ago
The types are definitely isomorphic, but the difference between them is not "pointless". You could have Either<IOError, Either<IOError, Result>> and want to preserve the information about which step led to an IOError outcome.
- deleted 7y ago[deleted]
- cousin_it 7y agoThat information shouldn't be in the type, because it makes functions pointlessly non-interchangeable. With try-catch, a superset of that information is preserved in the stack trace, and functions stay interchangeable.
- esarbe 7y agoI consider the error types to be a useful information that should absolutely be part of the method type. If a method can fail on IO that's different than if it cannot fail. And the surrounding code has to account for that. So, you might think that the methods are interchangeable if the error type is not present in the signature but this is actually wrong. Different failures have to be handled differently. (I assume that you are /not/ talking about valid error cases in the problem domain that also might have to be handled)
- deleted 7y ago[deleted]