Safe Haskell  None 

A reconstruction of the operational
package in terms of the
FreeT
monad transformer.
This module is meant to be a dropin replacement for its
counterpart in the operational
package. Some of the
implementation choices reflect that:

andProgram
instr
are type synonyms forProgramView
instr
andProgramT
instr m
, just as inProgramViewT
instr moperational
. If you don't care for that, Control.Monad.Operational.Simple implements them directly in terms ofFree
.
The ProgramT
and ProgramViewT
types and operations are
reexported from Control.Monad.Trans.Operational.
 module Control.Operational.Class
 module Control.Monad.Trans.Operational
 type Program instr = ProgramT instr Identity
 toFree :: Program instr a > Free (Yoneda instr) a
 fromProgram :: (Operational instr m, Functor m, Monad m) => Program instr a > m a
 liftProgram :: Monad m => Program instr a > ProgramT instr m a
 interpret :: forall m instr a. (Functor m, Monad m) => (forall x. instr x > m x) > Program instr a > m a
 interpretWithMonad :: Monad m => (forall x. instr x > m x) > Program instr a > m a
 type ProgramView instr = ProgramViewT instr Identity
 view :: Program instr a > ProgramView instr a
Documentation
module Control.Operational.Class
type Program instr = ProgramT instr IdentitySource
Dropin replacement for operational
's type synonym.
fromProgram :: (Operational instr m, Functor m, Monad m) => Program instr a > m aSource
Lift a Program
into any Operational
type at least as strong
as Monad
.
liftProgram :: Monad m => Program instr a > ProgramT instr m aSource
Lift a Program
into a ProgramT
. Really the same as
fromProgram
, but with a more restricted type; this function is a
dropin replacement for the eponymous function in operational
.
interpret :: forall m instr a. (Functor m, Monad m) => (forall x. instr x > m x) > Program instr a > m aSource
Interpret a Program
by interpreting each instruction as a
monadic action. Unlike interpretWithMonad
, this soes not use
view
nor ProgramView
.
This function is not a dropin replacement for interpretWithMonad
because it has an extra Functor m
constraint.
interpretWithMonad :: Monad m => (forall x. instr x > m x) > Program instr a > m aSource
type ProgramView instr = ProgramViewT instr IdentitySource
Dropin replacement for operational
's eponymous type synonym.
view :: Program instr a > ProgramView instr aSource
Dropin replacement for operational
's function.