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— aperformwithout a matchingwithdeclaration.TE809— the summary form for a boundary fn missing multiple effects at once.- /docs/algebraic-effects — effect propagation across function calls.