Skip to content
ZOLO / TE802 Effects · error

calls a function requiring an undeclared effect

A `handle` block tries to handle an operation the effect did not declare.

Why this fires

A boundary function (pub fn, or an impl method) calls another function that requires an effect the caller hasn't declared (in its own with clause) and hasn't handled locally.

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

fn helper() with Fs + Db {}

pub fn caller() with Fs {
    helper()
    // error[TE802]: function 'caller' calls 'helper' which requires effect 'Db',
    //               but 'caller' does not declare 'with Db'
}

caller declares Fs but not Db, and helper needs both.

Fix it

1. Declare the missing effect too

pub fn caller() with Fs + Db {
    helper()                    // ok
}

2. Handle it locally

pub fn caller() with Fs {
    handle helper() with {
        Db::query(_) => "x",
    }
}

See also

  • TE800 — a perform without a matching with declaration.
  • TE809 — the summary form for a boundary fn missing multiple effects at once.
  • /docs/algebraic-effects — effect propagation across function calls.

Global index

Find your way through Zolo

Try an idea

Start here

9 results

9 results

enespt-br