free-operational-0.5.0.0: Operational Applicative, Alternative, Monad and MonadPlus from free types.

Safe HaskellSafe-Inferred

Control.Operational.Instruction

Description

Utility functions for working with instructions and instruction sets.

The Data.Functor.Coproduct module is very useful with instruction sets, so this module reexports it. The Coproduct type can be used to take the union of two instruction sets, and the coproduct function can be used to construct an instruction evaluation for such an union. So if we have these two instruction evaluations:

 evalI  :: forall x. instr  x -> f x
 evalI' :: forall x. instr' x -> f x 

then their coproduct is an evaluation for the union of the instruction sets:

 coproduct evalI evalI' :: forall x. (Coproduct instr instr' x) -> f x

Synopsis

Documentation

liftEvalI :: Functor f => (forall x. instr x -> f x) -> Coyoneda instr a -> f aSource

Lift an operational instruction evaluator into a free Functor evaluator.

liftInstr :: instr a -> Coyoneda instr aSource