Hi, I've seen the new changes for 0.12.0 and `Eith...
# arrow
n
Hi, I've seen the new changes for 0.12.0 and
Either.catch
with
suspend
functions is deprecated and the inline one is not accepting them. How should it be done with this new version?
s
inline
functions accepts
suspend
functions in their lambda if their outer scope is also
suspend
.
Copy code
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.
n
Yeah. My bad sorry, a
noinline
modifier was messing with the extension function I was using with
Either.catch
and I didn't realize. Thx @simon.vergauwen