Module Prelude.Maybe

Provides functions and instances for the Maybe type.

Compatible with the Haskell 2010 Data.Maybe module.

Imports

Table of Content

Definitions

isJustMaybe 𝖆Bool

true if and only if the argument is a Maybe.Just value

isNothingMaybe 𝖆Bool

true if and only if the argument is Maybe.Nothing

This function is preferable over v == Nothing because no Eq constraint is needed.

fromMaybe ∷ 𝖆 → Maybe 𝖆 → 𝖆

fromMaybe d (Just a) returns a and fromMaybe d Nothing returns d

unJustMaybe 𝖆 → 𝖆

unJust Nothing is undefined whereas unJust (Just a) is a

catMaybesListSource 𝖇 ⇒ 𝖇 (Maybe 𝖆) → [𝖆]

The catMaybes function takes a list of Maybes and returns a list of all the Maybe.Just values.

mapMaybe ∷ (𝖇→Maybe 𝖆) → [𝖇] → [𝖆]

The mapMaybe function is a version of map which can throw out elements. In particular, the functional argument returns something of type Maybe b. If this is Maybe.Nothing, no element is added on to the result list. If it just Maybe.Just b, then b is included in the result list.

listToMaybeListSource 𝖇 ⇒ 𝖇 𝖆 → Maybe 𝖆

give the first element of a list or Maybe.Nothing

maybeToListMaybe a → [a]

convert a Maybe to a single element list or an empty list

Instances

instance Applicative Maybe

Member Functions

*>Maybe 𝖆 → Maybe 𝖇 → Maybe 𝖇
infixl  4

inherited from Applicative.*>

<*Maybe 𝖆 → Maybe 𝖇 → Maybe 𝖆
infixl  4

inherited from Applicative.<*

<*>Maybe (𝖆→𝖇)Maybe 𝖆 → Maybe 𝖇
infixl  4
pure ∷ 𝖆 → Maybe 𝖆
instance Eq a ⇒ Eq (Maybe a)

Member Functions

!=Eq 𝖆 ⇒ Maybe 𝖆Maybe 𝖆Bool
infix  7

inherited from Eq.!=

==Eq 𝖆 ⇒ Maybe 𝖆Maybe 𝖆Bool
infix  7

Function generated for derived instance.

hashCodeEq 𝖆 ⇒ Maybe 𝖆Int

Function generated for derived instance.

instance Functor Maybe

Member Functions

fmap ∷ (𝖆 → 𝖇) → Maybe 𝖆Maybe 𝖇
infixl  4
instance ListEmpty Maybe

Member Functions

emptyMaybe 𝖆
nullMaybe 𝖆Bool
instance MonadFail Maybe

Member Functions

failStringMaybe 𝖆
instance MonadPlus Maybe

Member Functions

mplusMaybe 𝖆Maybe 𝖆 → Maybe 𝖆
infixr  13
mzeroMaybe 𝖆
instance Monad Maybe

Member Functions

>>Maybe 𝖆Maybe 𝖇 → Maybe 𝖇
infixl  3
>>=Maybe 𝖆 → (𝖆 → Maybe 𝖇) → Maybe 𝖇
infixl  3
 Nothing >>= _ = Nothing
 Just a  >>= k = k a   
joinMaybe (Maybe 𝖆)Maybe 𝖆

inherited from Monad.join

instance Ord a ⇒ Ord (Maybe a)

Member Functions

<Ord 𝖆 ⇒ Maybe 𝖆Maybe 𝖆Bool
infix  9

inherited from Ord.<

<=Ord 𝖆 ⇒ Maybe 𝖆Maybe 𝖆Bool
infix  9

inherited from Ord.<=

<=>Ord 𝖆 ⇒ Maybe 𝖆Maybe 𝖆Ordering
infix  8

Function generated for derived instance.

>Ord 𝖆 ⇒ Maybe 𝖆Maybe 𝖆Bool
infix  9

inherited from Ord.>

>=Ord 𝖆 ⇒ Maybe 𝖆Maybe 𝖆Bool
infix  9

inherited from Ord.>=

compareOrd 𝖆 ⇒ Maybe 𝖆Maybe 𝖆Ordering
infix  8

inherited from Ord.compare

maxOrd 𝖆 ⇒ Maybe 𝖆Maybe 𝖆Maybe 𝖆

inherited from Ord.max

minOrd 𝖆 ⇒ Maybe 𝖆Maybe 𝖆Maybe 𝖆

inherited from Ord.min

Functions and Values by Type

Maybe (Maybe 𝖆) → Maybe 𝖆

Monad_Maybe.join

Maybe a → [a]

maybeToList

Maybe 𝖆 → Maybe 𝖆 → Maybe 𝖆

MonadPlus_Maybe.mplus

Maybe 𝖆 → Bool

isJust, isNothing, ListEmpty_Maybe.null

Maybe 𝖆 → 𝖆

unJust

StringMaybe 𝖆

MonadFail_Maybe.fail

𝖆 → Maybe 𝖆 → 𝖆

fromMaybe

𝖆 → Maybe 𝖆

Applicative_Maybe.pure

Eq 𝖆 ⇒ Maybe 𝖆 → Maybe 𝖆 → Bool

Eq_Maybe.!=, Eq_Maybe.==

Eq 𝖆 ⇒ Maybe 𝖆 → Int

Eq_Maybe.hashCode

Ord 𝖆 ⇒ Maybe 𝖆 → Maybe 𝖆 → Maybe 𝖆

Ord_Maybe.min, Ord_Maybe.max

Ord 𝖆 ⇒ Maybe 𝖆 → Maybe 𝖆 → Bool

Ord_Maybe.>=, Ord_Maybe.<, Ord_Maybe.<=, Ord_Maybe.>

Ord 𝖆 ⇒ Maybe 𝖆 → Maybe 𝖆 → Ordering

Ord_Maybe.compare, Ord_Maybe.<=>

Maybe 𝖆

ListEmpty_Maybe.empty, MonadPlus_Maybe.mzero

(𝖆 → 𝖇) → Maybe 𝖆 → Maybe 𝖇

Functor_Maybe.fmap

(𝖇→Maybe 𝖆) → [𝖇] → [𝖆]

mapMaybe

Maybe (𝖆→𝖇) → Maybe 𝖆 → Maybe 𝖇

Applicative_Maybe.<*>

Maybe 𝖆 → (𝖆 → Maybe 𝖇) → Maybe 𝖇

Monad_Maybe.>>=

Maybe 𝖆 → Maybe 𝖇 → Maybe 𝖆

Applicative_Maybe.<*

Maybe 𝖆 → Maybe 𝖇 → Maybe 𝖇

Applicative_Maybe.*>, Monad_Maybe.>>

ListSource 𝖇 ⇒ 𝖇 (Maybe 𝖆) → [𝖆]

catMaybes

ListSource 𝖇 ⇒ 𝖇 𝖆 → Maybe 𝖆

listToMaybe

Valid HTML 4.01 Strict