Library for control flow inside of monads with anaphoric variants on if and when and a C-like "switch" function.

Information:

`Author`

- Jeff Heard
`Copyright`

- 2008 Jeff Heard
`License`

- BSD
`Version`

- 1.0
`Status`

- Alpha

- whenM :: Monad m => m Bool -> m () -> m ()
- cond :: Monad m => [(Bool, m ())] -> m ()
- condM :: Monad m => [(m Bool, m ())] -> m ()
- awhen :: Monad m => Maybe a -> (a -> m ()) -> m ()
- awhenM :: Monad m => m (Maybe a) -> (a -> m ()) -> m ()
- acond :: Monad m => [(Maybe a, a -> m ())] -> m ()
- aif :: Monad m => Maybe a -> (a -> m b) -> m b -> m b
- aifM :: Monad m => m (Maybe a) -> (a -> m b) -> m b -> m b

# Documentation

whenM :: Monad m => m Bool -> m () -> m ()Source

A if with no else for unit returning thunks. Returns the value of the test.

cond :: Monad m => [(Bool, m ())] -> m ()Source

Like a switch statement, and less cluttered than if else if

cond [ (t1,a1), (t2,a2), ... ]

condM :: Monad m => [(m Bool, m ())] -> m ()Source

Like a switch statement, and less cluttered than if else if

condM [ (t1,a1), (t2,a2), ... ]

awhen :: Monad m => Maybe a -> (a -> m ()) -> m ()Source

Chainable anaphoric when. Takes a maybe value.

if the value is Just x then execute ` action x `

, then return ` True `

. otherwise return ` False `

.