Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- module Data.Maybe
- data MaybeErr err val
- failME :: err -> MaybeErr err val
- isSuccess :: MaybeErr err val -> Bool
- orElse :: Maybe a -> a -> a
- firstJust :: Maybe a -> Maybe a -> Maybe a
- firstJusts :: [Maybe a] -> Maybe a
- whenIsJust :: Monad m => Maybe a -> (a -> m ()) -> m ()
- expectJust :: HasCallStack => String -> Maybe a -> a
- newtype MaybeT (m :: Type -> Type) a = MaybeT {}
- liftMaybeT :: Monad m => m a -> MaybeT m a
- tryMaybeT :: IO a -> MaybeT IO a
Documentation
module Data.Maybe
firstJusts :: [Maybe a] -> Maybe a Source #
Takes a list of Maybes
and returns the first Just
if there is one, or
Nothing
otherwise.
whenIsJust :: Monad m => Maybe a -> (a -> m ()) -> m () Source #
expectJust :: HasCallStack => String -> Maybe a -> a Source #
MaybeT
newtype MaybeT (m :: Type -> Type) a #
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.
Instances
liftMaybeT :: Monad m => m a -> MaybeT m a Source #