Open
Description
When using CAPTURE
in the javascript backend, this replaces the return value by $effekt.unit
. Some of the existing FFI relies on this behavior (we then don't have to explicitly return unit):
effekt/libraries/js/effekt_runtime.js
Lines 83 to 89 in fea824a
Example program
The following program triggers above behavior via promise.resolve
.
import io
extern io def rT[T](run: => T at {io, async, global}): T =
js "$effekt.runToplevel((ks, k) => ${run}(ks, k))"
def main() = {
val pr = promise::make[Int]()
println(rT[Int](box {
pr.resolve(2);
12
}))
}
Thanks @b-studios for helping to find the underlying cause.