simon.vergauwen
05/10/2020, 9:52 AMFiber, isn’t it weird that it randomly goes somewhere else then?
In the case below only forkConnected or forkAndForget would leak the exception.
In the case of forkConnected, which is the equivalent of `CoroutineScope.async`` would you expect that the error is send to an asyncErrorHandler as well as stay inside the Fiber for when you join it? So the error would be guaranteed to show up once in the asyncErrorHandler on top of the N times you can join it?
I.e.
/** Returns a fiber that is cancelled when its parent is cancelled **/
fun <A> IO<A>.forkConnected(): IO<Fiber<ForIO, A>>
/** Fork your `IO` in a `Fiber` and consume that fiber in a suspending way. Cancelling the parent will cancel this op.
All errors will be propagated to the result.
**/
fun <A, B> IO<A>.useFork(f: (Fiber<ForIO, A>) -> IO<B>): IO<B>
/** Current fiber **/
fun IO<A>.forkAndForget(): IO<Fiber<ForIO, A>>