Expand description
Effect-handler composition primitive (P-1.0-V1.2).
Builds a single handler from two: the composed handler discharges the union of the two handlers’ effect rows.
Algebraic laws (proven by tests below):
- Associativity:
compose(a, compose(b, c)) == compose(compose(a, b), c). - Commutativity:
compose(a, b) == compose(b, a)(handlers are modeled as effect rows; row-union is commutative). - Identity:
compose(a, identity) == awhere identity is the empty-row handler. - Idempotence on equal handlers:
compose(a, a) == a. - Apply-compose distributivity:
handler_apply(row, compose(a, b)) == handler_apply(handler_apply(row, a), b).
Functions§
- handler_
compose - Compose two handlers. The result discharges every effect kind in either input handler.