import std/io // A multi-shot `resume` called while its handler's body runs panics on // both backends: natively, the body's stack is in use (ADR 0017). type K { K(fn(K) -> Int / ) } effect amb { multi ctl fork :: -> K } pub fn main :: -> () / { let n = handle { let K(k) = fork () io.println "resuming from inside the body" k K(k) + 1 } with { fork -> resume K(resume) } io.println ("not reached " <> show n) } //> resuming from inside the body //! panic: `resume` called while its handler's body is running