I am looking for the most common way to do something like:
x :: IO ((),[SomeException])
x = do
void y
void z
aggregating exceptions that may be thrown by y and z and returning them as part of the type of x.
Is there a well-known monad / tutorial for this?
So the important question here is
augustss– “If y throws an exception, what would the value ofabe?”If you have default values for
a, andb, you can usetryto catch your exceptions and aggregate them usingWriterT:Without defaults though, you can’t rescue exceptions and continue computation.