| Safe Haskell | None | 
|---|---|
| Language | Haskell2010 | 
Maybes
Contents
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
data MaybeErr err val Source #
Instances
| Monad (MaybeErr err) # | |
| Functor (MaybeErr err) # | |
| Applicative (MaybeErr err) # | |
Defined in Maybes Methods pure :: a -> MaybeErr err a Source # (<*>) :: MaybeErr err (a -> b) -> MaybeErr err a -> MaybeErr err b Source # liftA2 :: (a -> b -> c) -> MaybeErr err a -> MaybeErr err b -> MaybeErr err c Source # (*>) :: MaybeErr err a -> MaybeErr err b -> MaybeErr err b Source # (<*) :: MaybeErr err a -> MaybeErr err b -> MaybeErr err a Source #  | |
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 Source #
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 #