Monadic Handlers for Polynomial Functors #
A PFunctor.Handler m q chooses a direction of q at each position, with the
choice interpreted in the type constructor m. This is the generic interface
consumed by FreeM.liftM; it does not depend on machines or dynamical systems.
In particular, taking m := StateT σ n threads one shared runtime state through
every handled position. That ambient state is distinct from a dynamical
system's private operational state.
A handler for the interface q: a monadic choice of direction at each
position (a Kleisli section of q). With m := Id this is an ordinary
dependent choice of one direction at every position, while a probabilistic
monad gives a randomized choice.
Instances For
Postcompose every answer computation of a handler by a polymorphic map between target type constructors. No monad laws are needed for this basic change-of-target operation.
Instances For
An effectful stateful handler for q: on each position it reads a state,
performs effects in m, and returns a direction together with the next state.
This is a transparent name for Handler (StateT S m) q, so it introduces no
new data or laws. At m := Id it is the pure Kleisli--Mealy presentation used
by Responder.equivStateHandler.
Instances For
Combine monadic handlers for an indexed family into a handler for its indexed coproduct.