Saltar al contenido
TE809 · Efectos · error

La función realiza efectos que no declara

La forma resumida de TE800: en lugar de reportar cada `perform`, reúne todos los efectos que la función de frontera realmente necesita y los reporta en la firma.

Why this fires

A boundary function (pub fn, or an impl method) performs one or more effects that it never declares in a with clause. This is the summary form of TE800: instead of reporting each perform site individually, TE809 collects every effect the function's body actually needs and reports them all in one message at the function's signature.

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

pub fn run() -> str {
    return perform Fs::read("config.toml")
    // error[TE809]: function 'run' performs effects {Fs} but does not declare
    //               them; add `with Fs`
}

Fix it

Add the missing with clause:

pub fn run() with Fs -> str {
    return perform Fs::read("config.toml")   // ok
}

See also

  • TE800 — the per-perform-site form of this same check (used at top-level code and inside spawn blocks, where there's no single function signature to summarize against).
  • TE802 — calling another function that requires an effect you haven't declared.
  • /docs/algebraic-effects — algebraic effects and with clauses.

Véase también

Buscar en Zolo

9 resultados

en