effekt
effekt copied to clipboard
Missing reset-and-immediately-shift-abort optimisation
effect fail(): Nothing
def main() = try {
do fail();
println("after")
} with fail { println("failed") }
produces the following optimised core with a reset immediately followed by a shift:
interface fail_3421 {}
def main_3422() = reset { {p_3561} =>
shift(p_3561) { {k_3584} =>
let tmp_3586 = println_1("failed")
return tmp_3586
}
}
But we can clearly eliminate this, right?
// ~>
def main_3422() = {
let tmp_3586 = println_1("failed")
return tmp_3586
}
I'd like to see a less trivial version of this, where statically known continuations are "inlined" as functions, and resumes become calls.
In this case k_3584 would become id (and get eliminated as unused function).
All of this is on the optimizer-wishlist and achievable by NbE :)