Saltar al contenido
TE810 · Efectos · warning

El handler cubre un efecto que el cuerpo nunca realiza

Es una advertencia, no un fallo de build. Un bloque `handle` que usa un handler-valor con anotación explícita `handler<…>` cubre un efecto que el cuerpo tratado nunca realiza.

Why this fires

This is a warning, not a hard error — it does not fail the build. A handle block, using a handler value typed with an explicit handler<...> annotation, covers an effect the handled body never actually performs.

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

let h: handler<Fs + Log, str> = handler {
    Fs::read(_p) => "stub",
    Log::info(_m) => "noop",
}

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

fn main() {
    let _ = handle run() with h
    // warning[TE810]: handler covers `Log` but the body never performs it
}

h is typed to cover both Fs and Log, but run() only ever performs Fs.

Fix it

Narrow the handler's declared coverage to only the effects the body actually performs:

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

Or, if Log was meant to be performed somewhere, make sure the call is wired up correctly (a typo in a called function's name can silently make an effect look unused).

See also

  • TE803 — the opposite problem: a handler that does NOT cover an effect the body performs (a hard error).
  • /docs/algebraic-effects — handler values and the handler<...> type.

Véase también

Buscar en Zolo

9 resultados

en