| Portability | RankNTypes |
|---|---|
| Stability | experimental |
| Maintainer | Fumiaki Kinoshita <fumiexcel@gmail.com> |
| Safe Haskell | Safe-Inferred |
Control.Monad.Operational.Mini
Description
Simple operational monad
- newtype Program t a = Program {
- unProgram :: forall r. (a -> r) -> (forall x. t x -> (x -> r) -> r) -> r
- interpret :: Monad m => (forall x. t x -> m x) -> Program t a -> m a
- cloneProgram :: Operational t m => Program t a -> m a
- data ReifiedProgram t a where
- Return :: a -> ReifiedProgram t a
- :>>= :: t a -> (a -> ReifiedProgram t b) -> ReifiedProgram t b
- fromReified :: ReifiedProgram t a -> Program t a
- module Control.Monad.Operational.Class
Documentation
Program t is a Monad that represents a sequence of imperatives.
To construct imperatives, use singleton :: t a -> Program t a.
Instances
| Operational t (Program t) | |
| Monad (Program t) | |
| Functor (Program t) | |
| Applicative (Program t) |
interpret :: Monad m => (forall x. t x -> m x) -> Program t a -> m aSource
Interpret a Program using the given transformation.
cloneProgram :: Operational t m => Program t a -> m aSource
data ReifiedProgram t a whereSource
Reified version of Program. It is useful for testing.
Constructors
| Return :: a -> ReifiedProgram t a | |
| :>>= :: t a -> (a -> ReifiedProgram t b) -> ReifiedProgram t b |
Instances
| Operational t (ReifiedProgram t) | |
| Monad (ReifiedProgram t) | |
| Functor (ReifiedProgram t) | |
| Applicative (ReifiedProgram t) |
fromReified :: ReifiedProgram t a -> Program t aSource