Skip to main content

Module effects

Module effects 

Source
Expand description

Effect tracking — E-AIR pass.

Tracks algebraic-effect usage through the call graph. Verifies that declared effect clauses (with Log, Clock) match the effects actually used or propagated from called functions.

§Algorithm

  1. Collect — all top-level function declarations are entered into a map together with their declared effect clause.
  2. Infer — for each function, actual effects are collected by walking the body for EffectOp invocations and calls to other known functions.
  3. Propagate — effects from called functions are added to the caller’s inferred set (one-level; declaration map is built in phase 1).
  4. Check — declared vs inferred effects are compared per strictness:
    • Sketch mode: auto-infer (no diagnostics emitted).
    • Development mode: warn for undeclared effects on public functions.
    • Production mode: error for undeclared effects on all functions.

§Effect-Capability Correlation

IO effects correlate with capabilities (e.g. LogIo.Stdout, HttpIo.Network). The correlation is recorded as a note on the diagnostic for consumption by downstream passes.

Structs§

EffectRef
A reference to an algebraic effect, identified by its fully-qualified name.

Enums§

Strictness
Graduated strictness level for effect checking.

Functions§

infer_effects
Infer the effects used in a function node without checking declarations.
track_effects
Track effect usage through the call graph of module and emit diagnostics according to strictness.