3 ms·
If you go all-in with monadic error handling, you end up with code that is isomorphic with and semantically equivalent to checked exceptions. The only differen
by barrkel 9y ago
If you go all-in with monadic error handling, you end up with code that is isomorphic with and semantically equivalent to checked exceptions.
The only difference, in so far as there is a difference, is in how low-level of a primitive you permit to (throw|return Either). For example, do you model floating-point division as returning an Either, since the divisor might be zero - that kind of thing. Exceptions tend to encourage errors from a lower level of primitive.
- saurik 9y agoI agree. ! However, to go "all-in" on monadic error handling requires you to have do notation to abstract away the monad, lest you end up with something (a thing we happen to call Rust ;P) that is much worse than just giving someone checked exceptions.