-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Implement monads by specifying operational semantics. -- -- Tiny library for implementing monads by specifying the primitive -- instructions and their operational semantics. The monad laws will hold -- automatically. Can also be used to define monad transformers, and the -- lifting laws are, again, automatic. -- -- Accompanies the article: "The Operational Monad Tutorial", published -- in Issue 15 of The Monad.Reader -- http://themonadreader.wordpress.com/2010/01/26/issue-15/. -- -- Related packages: MonadPrompt -- http://hackage.haskell.org/package/MonadPrompt. @package operational @version 0.2.0.3 -- | Implement monads by specifying primitive instructions and their -- operational semantics. -- -- This package is based on the "The Operational Monad Tutorial", -- published in Issue 15 of The Monad.Reader -- http://themonadreader.wordpress.com/. -- -- You are reading the API reference. For more thorough documentation -- including design and implementation notes as well as a correctness -- proof, please consult the included documentation in -- doc/Documentation.md, also available at -- http://heinrichapfelmus.github.com/operational/Documentation.html -- . -- -- This API reference includes only basic example code. More intricate -- examples are available in the doc/examples directory, also -- available at -- https://github.com/HeinrichApfelmus/operational/tree/master/doc/examples#readme. module Control.Monad.Operational -- | The abstract data type 'Program instr a' represents programs. -- --
-- liftProgram = eval . view -- where -- eval :: ProgramView instr a -> ProgramT instr m a -- eval (Return a) = return a -- eval (i :>>= k) = singleton i >>= liftProgram . k --liftProgram :: Monad m => Program instr a -> ProgramT instr m a instance MonadIO m => MonadIO (ProgramT instr m) instance MonadState s m => MonadState s (ProgramT instr m) instance Monad m => Applicative (ProgramT instr m) instance Monad m => Functor (ProgramT instr m) instance MonadTrans (ProgramT instr) instance Monad m => Monad (ProgramT instr m)