Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell98 |
- module Data.Maybe
- data MaybeErr err val
- failME :: err -> MaybeErr err val
- isSuccess :: MaybeErr err val -> Bool
- orElse :: Maybe a -> a -> a
- mapCatMaybes :: (a -> Maybe b) -> [a] -> [b]
- allMaybes :: [Maybe a] -> Maybe [a]
- firstJust :: Maybe a -> Maybe a -> Maybe a
- firstJusts :: [Maybe a] -> Maybe a
- whenIsJust :: Monad m => Maybe a -> (a -> m ()) -> m ()
- expectJust :: String -> Maybe a -> a
- maybeToBool :: Maybe a -> Bool
- newtype MaybeT m a = MaybeT {}
Documentation
module Data.Maybe
mapCatMaybes :: (a -> Maybe b) -> [a] -> [b]Source
allMaybes :: [Maybe a] -> Maybe [a]Source
Collects a list of Justs
into a single Just
, returning Nothing
if
there are any Nothings
.
firstJusts :: [Maybe a] -> Maybe aSource
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 :: String -> Maybe a -> aSource
maybeToBool :: Maybe a -> BoolSource