simon.vergauwen
05/17/2019, 7:17 PMunsafe
is run in a suspend function. So this is still a pure function
suspend fun <A> IO<A>.runSuspend(): A = suspendCoroutine { cont ->
unsafeRunAsync { either ->
either.fold({ e -> cont.resumeWithException(e) }, { a -> cont.resumeWith(a) })
}
}