Closed okkero closed 6 years ago
Fix on 1.2
I see you marked eitherTry
as inline in 1.2, but the reality is almost every function that accepts a lambda callback should be marked inline so that it can be used from a coroutine when the callback might suspend.
Functions like
eitherTry
andTry
would also be useful when catching exceptions thrown by suspending functions. The current implementations don't support this. For example, I cannot to this:This fails to compile on
a.await
because we are not in a suspending block.I see two potential solutions:
eitherTry
becomessuspend fun <T> eitherTry(body: suspend () -> T): Either<Throwable, T>
inline
.