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 insidespawnblocks, 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
withclauses.