Open
Description
Suppose we have the following IO
tree:
IO<Object> throwImmediately = IO.throwing(new IllegalStateException("head fell off"));
IO<Unit> parkForever = io((SideEffect) LockSupport::park);
throwImmediately.discardL(parkForever).unsafePerformAsyncIO().join();
What should the result be? Should it throw, or block?
Intuitively, it feels like it should probably throw immediately, and why wouldn't it? Well, because there is asynchrony, and since discardL
is just a sugary zip
call, and since zip
can only execute once both results have been computed, the backing future holding the thrown exception will never be interrogated, so the exception will never propagate.
Investigate whether or not a principled approach to parallel IO
can also easily immediately propagate exceptions under the context of asynchrony without violating correctness.