Library with some useful functions on the Maybe
datatype.
Author: Frank Huch, Bernd Brassel, Bjoern Peemoeller
Version: October 2014
isJust
:: Maybe a > Bool
Return True
iff the argument is of the form Just _ .

isNothing
:: Maybe a > Bool
Return True
iff the argument is of the form Nothing .

fromJust
:: Maybe a > a
Extract the argument from the Just
constructor and throw an error
if the argument is Nothing .

fromMaybe
:: a > Maybe a > a
Extract the argument from the Just
constructor or return the provided
default value if the argument is Nothing .

listToMaybe
:: [a] > Maybe a
Return Nothing
on an empty list or Just x
where x
is the first
list element.

maybeToList
:: Maybe a > [a]
Return an empty list for Nothing
or a singleton list for Just x .

catMaybes
:: [Maybe a] > [a]
Return the list of all Just
values.

mapMaybe
:: (a > Maybe b) > [a] > [b]
Apply a function which may throw out elements using the Nothing
constructor to a list of elements.

(>>)
:: 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 .

mplus
:: Maybe a > Maybe a > Maybe a
Combine two Maybe s, returning the first Just
value, if any.

Return

Return

Extract the argument from the 
Extract the argument from the

Return

Return an empty list for

Return the list of all 
Apply a function which may throw out elements using the 
Monadic bind for Maybe. Maybe can be interpreted as a monad where Nothing is interpreted as the error case by this monadic binding.

Monadic 
Monadic 
Combine two
