free-operational-0.3.0.0: Operational Applicative, Alternative, Monad and MonadPlus, built with free types.

Safe HaskellNone

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) -> Yoneda instr a -> f aSource

Lift an operational instruction evaluator into a free Functor evaluator.

liftInstr :: instr a -> Yoneda instr aSource