Portability | portable |
---|---|

Stability | experimental |

Maintainer | ross@soi.city.ac.uk |

Safe Haskell | Safe-Inferred |

The `MaybeT`

monad transformer extends a monad with the ability to exit
the computation without returning a value.

A sequence of actions produces a value only if all the actions in the sequence do. If one exits, the rest of the sequence is skipped and the composite action exits.

For a variant allowing a range of exception values, see Control.Monad.Trans.Except.

- newtype MaybeT m a = MaybeT (m (Maybe a))
- runMaybeT :: MaybeT m a -> m (Maybe a)
- mapMaybeT :: (m (Maybe a) -> n (Maybe b)) -> MaybeT m a -> MaybeT n b
- maybeToExceptT :: Functor m => e -> MaybeT m a -> ExceptT e m a
- exceptToMaybeT :: Functor m => ExceptT e m a -> MaybeT m a
- liftCallCC :: CallCC m (Maybe a) (Maybe b) -> CallCC (MaybeT m) a b
- liftCatch :: Catch e m (Maybe a) -> Catch e (MaybeT m) a
- liftListen :: Monad m => Listen w m (Maybe a) -> Listen w (MaybeT m) a
- liftPass :: Monad m => Pass w m (Maybe a) -> Pass w (MaybeT m) a

# The MaybeT monad transformer

The parameterizable maybe monad, obtained by composing an arbitrary
monad with the `Maybe`

monad.

Computations are actions that may produce a value or exit.

The `return`

function yields a computation that produces that
value, while `>>=`

sequences two subcomputations, exiting if either
computation does.

MonadTrans MaybeT | |

Monad m => Monad (MaybeT m) | |

Functor m => Functor (MaybeT m) | |

MonadFix m => MonadFix (MaybeT m) | |

Monad m => MonadPlus (MaybeT m) | |

(Functor m, Monad m) => Applicative (MaybeT m) | |

Foldable f => Foldable (MaybeT f) | |

Traversable f => Traversable (MaybeT f) | |

(Functor m, Monad m) => Alternative (MaybeT m) | |

MonadIO m => MonadIO (MaybeT m) | |

Show1 m => Show1 (MaybeT m) | |

Read1 m => Read1 (MaybeT m) | |

Ord1 m => Ord1 (MaybeT m) | |

Eq1 m => Eq1 (MaybeT m) | |

(Eq1 m, Eq a) => Eq (MaybeT m a) | |

(Ord1 m, Ord a) => Ord (MaybeT m a) | |

(Read1 m, Read a) => Read (MaybeT m a) | |

(Show1 m, Show a) => Show (MaybeT m a) |

# Conversion

maybeToExceptT :: Functor m => e -> MaybeT m a -> ExceptT e m aSource

exceptToMaybeT :: Functor m => ExceptT e m a -> MaybeT m aSource

# Lifting other operations

liftCallCC :: CallCC m (Maybe a) (Maybe b) -> CallCC (MaybeT m) a bSource

Lift a `callCC`

operation to the new monad.

liftCatch :: Catch e m (Maybe a) -> Catch e (MaybeT m) aSource

Lift a `catchE`

operation to the new monad.