niltsiar
04/02/2021, 9:01 AMEither.catch
with suspend
functions is deprecated and the inline one is not accepting them. How should it be done with this new version?simon.vergauwen
04/02/2021, 9:07 AMinline
functions accepts suspend
functions in their lambda if their outer scope is also suspend
.
suspend fun putStrLn(): Unit = Unit
suspend fun test(): Either<Throwable, Unit> =
Either.catch { putStrLn() }
If the outer fun is suspend
than the catch
function also become suspend
since its body is inlined
by the compiler.niltsiar
04/02/2021, 7:50 PMnoinline
modifier was messing with the extension function I was using with Either.catch
and I didn't realize. Thx @simon.vergauwen