Skip to content
TE814 · Effects · error

`handle … with h` requires a handler value

`h` must be something whose type is `handler<…>`. If it resolves to anything else, there's no arm set to dispatch the performed operations to.

Why this fires

handle <expr> with h requires h to be a handler value — something whose type is handler<...>. If h resolves to anything else, there's no arm set to dispatch the performed operations to.

effect Fs { fn read(p: str) -> str }

fn run() with Fs -> str {
    return perform Fs::read("x")
}

let not_a_handler = 42

fn main() {
    let _ = handle run() with not_a_handler
    //                         ^^^^^^^^^^^^ error[TE814]: `handle expr with h` requires
    //                         `h: handler<...>`, got `int`
}

Fix it

Pass an actual handler value:

let h = handler {
    Fs::read(_p) => "stub",
}

fn main() {
    let _ = handle run() with h   // ok
}

See also

See also

Search Zolo

9 results

en