Exceptions are often a better way to handle errors than returning them as values. We argue that traditional exceptions provide better user and developer experience, and show that they even result in faster execution.
I don’t know the answer to your question, but I think that what is needed is just a bit of syntactic sugar, e.g. Rust has ? for returning compatible errors without looking into them. That seems to be powered by Try trait, that may be a monad, but I am not fluent enough to check if it formally is.
I don’t know the answer to your question, but I think that what is needed is just a bit of syntactic sugar, e.g. Rust has
?
for returning compatible errors without looking into them. That seems to be powered byTry
trait, that may be a monad, but I am not fluent enough to check if it formally is.