Navigation

Effects

11 pages

State
state effect: mutable state threaded by the handler; get/put/modify with update/gets sugar and a standard handler.
Reader
reader effect: read-only environment threaded as immutable state; ask/asks/local with a standard handler. Read-only restriction of state.
Writer
writer effect: append-only output via tell/tellAll with a list-collecting handler. Append-only restriction of state.
Acc
acc effect: incremental list building via emit/emitAll/collect with a default handler that appends to a list state.
Error
error effect: raise/raiseWith with three handler strategies — strict (throw), collecting (accumulate list), and result (tagged abort).
Conditions
conditions effect: Common-Lisp-style signal/warn with restart-based recovery; handler IS the algebra choosing among offered restarts.
Choice
choice effect: non-deterministic computation via choose/fail/guard with a listAll handler that explores every branch (list-monad semantics).
Scope
scope effect: computation-scoped handlers via Kyo-style effect rotation; provide/val/stateful/run/runWith plus handlersFromAttrs sugar.
Linear
linear effect: graded resource discipline (linear, affine, exact n, unlimited) via acquire/consume/release with a finalizer enforcing usage bounds.
Typecheck
typecheck effect handlers: strict / collecting / logging / firstN / summarize / pretty under `policy.*`; bridge between the type system and effects.
HasHandler
hasHandler: ask the runtime whether a handler with the given effect name exists in the surrounding scope; impure query.