polix.effects.registry
Multimethod dispatch for effect handlers.
Provides the core dispatch mechanism for applying effects. Built-in effects are registered here, and domain-specific effects can be added via register-effect!.
-apply-effect
multimethod
Internal multimethod for effect application. Dispatches on :type.
Handlers receive [state effect ctx opts] and return a result map with :state, :applied, :failed, and :pending keys.
Use register-effect! to add custom effect handlers.
effect-types
(effect-types)Returns the set of all registered effect types.
failure
(failure state effect error message)(failure state effect error message details)Creates a failed result with the original state and error information.
Optionally accepts a details map for additional context (e.g., conflict info).
merge-results
(merge-results r1 r2)Merges two results, combining applied, failed, and speculative vectors.
pending
(pending state effect residual)Creates a pending result for deferred effects.
Used when a conditional effect has an open residual and :on-residual :defer strategy. The caller can re-evaluate when more data becomes available.
register-effect!
(register-effect! effect-type handler-fn)success
(success state applied)Creates a successful result with the new state and applied effects.