Portability | GADTs, EmptyDataDecls, GeneralizedNewtypeDeriving, MultiParamTypeClasses, FlexibleInstances |
---|---|
Stability | experimental |
Maintainer | Matthew Mirman <mmirman@andrew.cmu.edu> |
Safe Haskell | None |
A module which defines the monad for ImperativeHaskell,
and some control operator to interact with MIO
- modifyOp :: (HasValue r (V TyVar r) i, HasValue r (V k r) i) => (a -> b -> a) -> V TyVar r a -> V k r b -> MIO i r ()
- if' :: (HasValue r (V b r) i, HasValue r valt i) => V b r Bool -> valt () -> MIO i r ()
- for' :: (CState i, HasValue r (V b r) i, HasValue r valt TyInLoop) => (MIO i r irr1, V b r Bool, MIO i r irr2) -> valt () -> MIO i r ()
- while' :: (HasValue r (V b r) i, HasValue r (V b r) TyInLoop, HasValue r valt TyInLoop, CState i) => V b r Bool -> valt () -> MIO i r ()
- break' :: MIO TyInLoop r ()
- continue' :: MIO TyInLoop r ()
- defer' :: HasValue r valt TyInFunc => valt a -> MIO i r ()
- function :: MIO TyInFunc a a -> MIO i b a
- new :: HasValue r (V TyVar r) i => a -> MIO i r (V TyVar r a)
- auto :: a
- runImperative :: MIO TyInFunc a a -> IO a
- io :: IO a -> MIO i r a
- data V b r a where
- data MIO i r a
- data TyInLoop
- data TyInFunc
- data TyVar
- data TyVal
- data TyComp i v
- (=:) :: (HasValue r valt i, HasValue r (V TyVar r) i) => V TyVar r a -> valt a -> MIO i r ()
- (&) :: V TyVar r a -> V TyVar s a
- class HasValue r b i | b -> r i where
- class CState i where
Documentation
modifyOp :: (HasValue r (V TyVar r) i, HasValue r (V k r) i) => (a -> b -> a) -> V TyVar r a -> V k r b -> MIO i r ()Source
makes a modification assignment operator
out of a binary haskell function.
The suggested use is to replicate functionality of assignments
like modifyOp
-=
or %=
from C style languages.
if' :: (HasValue r (V b r) i, HasValue r valt i) => V b r Bool -> valt () -> MIO i r ()Source
only performs if'
(check) actact
if check
evaluates to true
it is specifically a value in its argument.
for' :: (CState i, HasValue r (V b r) i, HasValue r valt TyInLoop) => (MIO i r irr1, V b r Bool, MIO i r irr2) -> valt () -> MIO i r ()Source
acts like its imperative for'
(init, check, incr)for
counterpart
while' :: (HasValue r (V b r) i, HasValue r (V b r) TyInLoop, HasValue r valt TyInLoop, CState i) => V b r Bool -> valt () -> MIO i r ()Source
acts like its imperative while'
(check)while
counterpart.
continue' :: MIO TyInLoop r ()Source
continue'
continues the current loop, passing over
any control flow that is defined.
defer' :: HasValue r valt TyInFunc => valt a -> MIO i r ()Source
defer'
executes the given action (or value) before the
function returns.
function :: MIO TyInFunc a a -> MIO i b aSource
takes an ImperativeMonad action and removes it from it's
specific function context, specifically making it applicable
in the body of other functions.
function
foo
new :: HasValue r (V TyVar r) i => a -> MIO i r (V TyVar r a)Source
new
constructs a new reference to the specified pure value
runImperative :: MIO TyInFunc a a -> IO aSource
takes an MIO action as returned by a function,
and lifts it into IO.
runImperative
(=:) :: (HasValue r valt i, HasValue r (V TyVar r) i) => V TyVar r a -> valt a -> MIO i r ()Source
variable
executes =:
valuevalue
and writes it
to the location pointed to by variable