As for things related to these functions throwing ...
# arrow
r
As for things related to these functions throwing exceptions, that is not the reason they are in IO only. You could capture exceptions with
Try
even when being unable to suspend effects. When we run:
Try { println("whatever") }
the effect is immediately executed, not suspended and exceptions are still captured. It is true though that since
MonadDefer
and
IO
extend or provide instances of
MonadError<F, Throwable>
when you call
MonadDefer<F>#invoke
or
IO#invoke
if when the IO loop runs whatever you placed in there threw an exception it would be encapsulated and it would not blow the stack and you can get it back whenever you want with
attempt
or
handle|handleWith