Library with some useful functions on the Maybe datatype
Author: Frank Huch (source from the corresponding Hugs module)
Bernd Brassel (sequence, mapM)
Version: April 2005
Functions:
>>-
| catMaybes
| fromJust
| fromMaybe
| isJust
| isNothing
| listToMaybe
| mapMaybe
| mapMMaybe
| maybeToList
| sequenceMaybe
|
Summary of exported functions:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mapMaybe :: (a -> Maybe b) -> [a] -> [b]
|
|
|
|
(>>-) :: Maybe a -> (a -> Maybe b) -> Maybe b
|
|
Monadic bind for Maybe.
|
|
sequenceMaybe :: [Maybe a] -> Maybe [a]
|
|
monadic sequence for maybe
|
|
mapMMaybe :: (a -> Maybe b) -> [a] -> Maybe [b]
|
|
monadic map for maybe
|
|
Prelude
isJust :: Maybe a -> Bool
-
Further infos:
-
-
solution complete, i.e., able to compute all solutions
isNothing :: Maybe a -> Bool
-
Further infos:
-
-
solution complete, i.e., able to compute all solutions
fromJust :: Maybe a -> a
fromMaybe :: a -> Maybe a -> a
-
Further infos:
-
-
solution complete, i.e., able to compute all solutions
maybeToList :: Maybe a -> [a]
-
Further infos:
-
-
solution complete, i.e., able to compute all solutions
listToMaybe :: [a] -> Maybe a
-
Further infos:
-
-
solution complete, i.e., able to compute all solutions
catMaybes :: [Maybe a] -> [a]
mapMaybe :: (a -> Maybe b) -> [a] -> [b]
(>>-) :: Maybe a -> (a -> Maybe b) -> Maybe b
Monadic bind for Maybe.
Maybe can be interpreted as a monad where Nothing is interpreted
as the error case by this monadic binding.
Example call: (maybeValue >>- f)
-
Parameters:
-
maybeValue
- Nothing or Just x
-
f
- function to be applied to x
-
Returns:
-
Nothing if maybeValue is Nothing,
otherwise f is applied to x
-
Further infos:
-
-
defined as left-associative infix operator with precedence 1
sequenceMaybe :: [Maybe a] -> Maybe [a]
monadic sequence for maybe
mapMMaybe :: (a -> Maybe b) -> [a] -> Maybe [b]
monadic map for maybe
Generated by CurryDoc
(Version 0.4.1 of June 7, 2007) at Aug 28 15:25:36 2008