Skip to content
ZOLO / TE814 Effects · error

`handle ... with h` requires `h: handler<...>`

`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

Global index

Find your way through Zolo

Try an idea

Start here

9 results

9 results

enespt-br