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 :: * -> *) 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 :: * -> *) 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
MonadTrans MaybeT | |
Monad m => Monad (MaybeT m) | |
Functor m => Functor (MaybeT m) | |
MonadFix m => MonadFix (MaybeT m) | |
Monad m => MonadFail (MaybeT m) | |
(Functor m, Monad m) => Applicative (MaybeT m) | |
Foldable f => Foldable (MaybeT f) | |
fold :: Monoid m => MaybeT f m -> m # foldMap :: Monoid m => (a -> m) -> MaybeT f a -> m # foldr :: (a -> b -> b) -> b -> MaybeT f a -> b # foldr' :: (a -> b -> b) -> b -> MaybeT f a -> b # foldl :: (b -> a -> b) -> b -> MaybeT f a -> b # foldl' :: (b -> a -> b) -> b -> MaybeT f a -> b # foldr1 :: (a -> a -> a) -> MaybeT f a -> a # foldl1 :: (a -> a -> a) -> MaybeT f a -> a # elem :: Eq a => a -> MaybeT f a -> Bool # maximum :: Ord a => MaybeT f a -> a # minimum :: Ord a => MaybeT f a -> a # | |
Traversable f => Traversable (MaybeT f) | |
Eq1 m => Eq1 (MaybeT m) | |
Ord1 m => Ord1 (MaybeT m) | |
Read1 m => Read1 (MaybeT m) | |
Show1 m => Show1 (MaybeT m) | |
MonadZip m => MonadZip (MaybeT m) | |
MonadIO m => MonadIO (MaybeT m) | |
(Functor m, Monad m) => Alternative (MaybeT m) | |
Monad m => MonadPlus (MaybeT m) | |
(Monad m, HasDynFlags m) => HasDynFlags (MaybeT m) Source # | |
getDynFlags :: MaybeT m DynFlags Source # | |
(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) | |
liftMaybeT :: Monad m => m a -> MaybeT m a Source #