|Portability||GADTs, EmptyDataDecls, GeneralizedNewtypeDeriving, MultiParamTypeClasses, FunctionalDependencies, FlexibleInstances, UndecidableInstances|
|Maintainer||Matthew Mirman <email@example.com>|
A module which defines the monad for ImperativeHaskell,
and some control operator to interact with
- modifyOp :: (a -> b -> a) -> V Var r a -> V k r b -> MIO r ()
- if' :: V b r Bool -> MIO r () -> MIO r ()
- for' :: (MIO r irr1, V b r Bool, MIO r irr2) -> MIO r () -> MIO r ()
- while' :: V b r Bool -> MIO r () -> MIO r ()
- break' :: MIO a ()
- continue' :: MIO a ()
- return' :: Returnable b r => V a b b -> MIO b r
- returnV :: V a b b -> MIO b ()
- returnF :: V a b b -> MIO b b
- function :: MIO a a -> MIO b a
- new :: a -> MIO r (V Var r a)
- auto :: a
- runImperative :: MIO a a -> IO a
- liftOp :: (t -> a) -> V b r t -> V Comp r a
- liftOp2 :: (t -> t1 -> a) -> V b r t -> V b1 r t1 -> V Comp r a
- liftOp3 :: (t -> t1 -> t2 -> a) -> V b r t -> V b1 r t1 -> V b2 r t2 -> V Comp r a
- liftOp4 :: (t -> t1 -> t2 -> t3 -> a) -> V b r t -> V b1 r t1 -> V b2 r t2 -> V b3 r t3 -> V Comp r a
- liftOp5 :: (t -> t1 -> t2 -> t4 -> t3 -> a) -> V b r t -> V b1 r t1 -> V b2 r t2 -> V b3 r t3 -> V b4 r t4 -> V Comp r a
- data V b r a where
- (=:) :: Assignable val => V Var r a -> val r a -> MIO r ()
- (&) :: V Var r a -> V Var s a
makes a modify operator out of a binary
'if'(check) m only executes m if the check is true.
it is specifically value in it's argument.
acts like the usual imperative for loop
for(init, check, incr)
continues the current loop, passing over
any control flow that is defined.
can act as returnF or returnV depending on use
if it does not work, it is likely that type inference
could not figure out a sensible alternative.
acts like the imperative return, where
if called, it will exit the current function and place the
returned value into the current continuation. Note, this
doesn't work as a last function call.
takes an ImperativeMonad action and removes it from it's
specific function context, specifically making it applicable
in the body of other functions.
auto should just be used where the
type can be automatically infered and we don't need an initial value
turns a pure function into one which
gets the values out of it's arguments
var simply rewrites whatever
var with whatever