S0012: effect call in pure expression
Generated from rellum-diagnostics/src/db.rs.
Explanation
Pure expressions run during Derive and compute values without performing runtime work. Effect calls run during Fire, after the tick's derived values and state updates are known. Mixing the phases would make evaluation order observable and break deterministic replay.
Common causes
- calling print!, write!, send!, or another effect from a = binding
- calling an effect inside a pure function body
- placing effect work in a feedback clause instead of an effect binding
Canonical fixes
- move the effect call into an effect binding
Before:
logged = print!(message)
After:
logged = message
main! on any => print!(logged)
- keep pure functions pure and call effects from main! or another ! binding
Before:
show(x: Int) : Int = print!(x)
After:
show(x: Int) : Int = x
main! = print!(show(1))
Code example
logged = print!(message)