You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We can leverage compiler plugins to automatically rewrite imperative flows that use Kind<F, A>.bind() into rewrites that are simply flatMap based. This will free us from the stack labels machinery which currently uses reflection, ties us to the JVM and it's slow.
An implementation may do the following:
Find all declarations of fx blocks
Digg into the function ordered KtCallExpression and find all suspend calls that use !
If there are dependencies between the order of operations Rewrite the function body so each ordered ! it translates into a flatMap chain where the remaining expressions below are nested ending in a final map.
fx {
val a =!fa
val c =!fb(a)
c +1
}
becomes:
fa.flatMap { a ->
fb(a)
}.map { c ->
c +1
}
This is similar as to how scala for comprehensions work and it would free us from being dependent on suspension and in general the coroutine limitations around fx
The text was updated successfully, but these errors were encountered:
We can leverage compiler plugins to automatically rewrite imperative flows that use
Kind<F, A>.bind()
into rewrites that are simplyflatMap
based. This will free us from the stack labels machinery which currently uses reflection, ties us to the JVM and it's slow.An implementation may do the following:
fx
blocksKtCallExpression
and find allsuspend
calls that use!
!
it translates into aflatMap
chain where the remaining expressions below are nested ending in a finalmap
.becomes:
This is similar as to how scala for comprehensions work and it would free us from being dependent on suspension and in general the coroutine limitations around fx
The text was updated successfully, but these errors were encountered: