| 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
- rightToMaybe :: Either a b -> Maybe b
- 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
data MaybeErr err val Source #
Instances
Instance details
Defined in Maybes
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 #
rightToMaybe :: Either a b -> Maybe b 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
Instance details
Defined in Control.Monad.Trans.Maybe
Instance details
Defined in Control.Monad.Trans.Maybe
Instance details
Defined in Control.Monad.Trans.Maybe
Methods
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 #
Instance details
Defined in Control.Monad.Trans.Maybe
Instance details
Defined in Control.Monad.Trans.Maybe
Instance details
Defined in Control.Monad.Trans.Maybe
Instance details
Defined in Control.Monad.Trans.Maybe
liftMaybeT :: Monad m => m a -> MaybeT m a Source #