It's inlined. Think of it as being copy-pasted into the place where you call it.
k
Kev
09/01/2022, 8:02 AM
I understand that much, what I don’t understand is that if it’s resolving some suspended function, shouldn’t that mean that it should be resolving some actual provided suspended function as the
f
parameter?
e
Emil Kantis
09/01/2022, 8:35 AM
Ah.. I see, now I'm also a bit confused.. 🙂
Emil Kantis
09/01/2022, 8:36 AM
you mean why the type of
f
isn't
suspend () -> Either<E, A>
, instead of
() -> Either<E, A>
?
k
Kev
09/01/2022, 9:45 AM
Yeah, that’s exactly my confusion
p
phldavies
09/01/2022, 9:58 AM
Because it’s inlined at the call-site, the body of
f
is directly called within the same scope - if it contains suspending calls then they would fall under the same constraints as if you’d written them directly in the call-site rather than in the lambda. As such, the call-site would have to be suspending if the block contained suspending calls.