Safe Haskell | None |
---|---|
Language | Haskell2010 |
Maybe functions.
Synopsis
- isJust :: Maybe a -> Bool
- isNothing :: Maybe a -> Bool
- fromJust :: Maybe a -> a
- fromMaybe :: a -> Maybe a -> a
- maybeToList :: Maybe a -> [a]
- listToMaybe :: [a] -> Maybe a
- catMaybes :: [Maybe a] -> [a]
- mapMaybe :: (a -> Maybe b) -> [a] -> [b]
- mapMaybeFB :: (b -> r -> r) -> (a -> Maybe b) -> a -> r -> r
- whenJust :: Maybe a -> (a -> Fay ()) -> Fay ()
- whenJust' :: Maybe a -> (a -> Fay b) -> Fay (Maybe b)
- onJust :: (a -> b) -> Maybe a -> Maybe b
- joinMaybe :: Maybe (Maybe a) -> Maybe a
General operations from base
maybeToList :: Maybe a -> [a] Source #
The maybeToList
function returns an empty list when given
Nothing
or a singleton list when not given Nothing
.
listToMaybe :: [a] -> Maybe a Source #
The listToMaybe
function returns Nothing
on an empty list
or
where Just
aa
is the first element of the list.
mapMaybeFB :: (b -> r -> r) -> (a -> Maybe b) -> a -> r -> r Source #