Why this fires¶
A handle ... with { ... } arm names an operation that doesn't exist on the effect — usually a typo.
effect Fs { fn read(p: str) -> str }
fn run() with Fs {}
fn driver() {
handle run() with {
Fs::ghost(_) => "x",
// ^^^^^ error[TE804]: effect 'Fs' has no operation 'ghost'
Fs::read(_) => "y",
}
}Fix it¶
Fix the operation name to match one the effect actually declares:
fn driver() {
handle run() with {
Fs::read(_) => "y", // ok
}
}See also¶
TE803— ahandleblock doesn't cover every operation of an effect.TE805— a handler arm's parameter count doesn't match the operation's arity.- /docs/algebraic-effects —
handleblocks and effect operations.