1 This module implements the ``State Transformer''
2 monad coupled with the ``Maybe'' monad, where the ``Maybe'' type is
3 wrapped around the pair containing the return value and the state.
4 \begin{haskell}{MaybeStateT}
7 >#ifndef __GLASGOW_HASKELL__
15 >#ifndef __GLASGOW_HASKELL__
19 > type MST s a = s -> Maybe (a, s)
21 > returnMST :: a -> MST s a
22 > returnMST x = \s -> Just (x, s)
24 > bindMST :: MST s a -> (a -> MST s b) -> MST s b
25 > bindMST m k s = m s >>= \(x, s') -> k x s'