Why this fires¶
A handle ... with { ... } arm's parameter list has a different number of parameters than the operation it handles declares.
effect Db {
fn insert(table: str, row: str) -> int
}
fn run() with Db {
let _ = perform Db::insert("t", "r")
}
fn driver() {
handle run() with {
Db::insert(a, b, c) => 0,
// ^^^^^^^ error[TE805]: handler arm 'Db::insert' expects 2
// parameters, got 3
}
}Fix it¶
Match the arm's parameter count to the operation's declared arity:
fn driver() {
handle run() with {
Db::insert(a, b) => 0, // ok — 2 parameters for a 2-parameter op
}
}See also¶
TE804— a handler arm names an operation the effect doesn't have.- /docs/algebraic-effects —
handleblocks and handler arms.