Saltar al contenido
TE808 · Efectos · error

Tipo de argumento incompatible en `perform`

Una llamada `perform Efecto::op(…)` pasó un argumento cuyo tipo no coincide con el tipo del parámetro declarado de la operación.

Why this fires

A perform Effect::op(...) call passed an argument whose type doesn't match the operation's declared parameter type.

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

fn run() with Fs {
    let _ = perform Fs::read(42)
    //                       ^^ error[TE808]: perform Fs::read: argument 1 has
    //                          type `int`, expected `str`
}

Fix it

Pass an argument of the declared type:

fn run() with Fs {
    let _ = perform Fs::read("hello")   // ok
}

See also

  • TE805 — a handler arm's parameter count doesn't match the operation's arity (the handling side of the same mismatch).
  • /docs/algebraic-effects — effect operation signatures.

Véase también

Buscar en Zolo

9 resultados

en