IdrisDoc: Prelude.Maybe

Prelude.Maybe

toMaybe : Bool -> Lazy a -> Maybe a

Returns Just the given value if the conditional is True
and Nothing if the conditional is False.

raiseToMaybe : Monoid a => Eq a => a -> Maybe a

Returns Nothing when applied to neutral, and Just the value otherwise.

maybe_bind : Maybe a -> (a -> Maybe b) -> Maybe b
maybe : Lazy b -> Lazy (a -> b) -> Maybe a -> b
lowerMaybe : Monoid a => Maybe a -> a

Convert a Maybe a value to an a value, using neutral in the case
that the Maybe value is Nothing.

justInjective : (Just x = Just y) -> x = y
isNothing : Maybe a -> Bool
isJust : Maybe a -> Bool
fromMaybe : Lazy a -> Maybe a -> a

Convert a Maybe a value to an a value by providing a default a value
in the case that the Maybe value is Nothing.

collectJust : Semigroup a => Semigroup (Maybe a)

Transform any semigroup into a monoid by using Nothing as the
designated neutral element and collecting the contents of the
Just constructors using a semigroup structure on a. This is
the behaviour in the Haskell libraries.

data Maybe : (a : Type) -> Type

An optional value. This can be used to represent the possibility of
failure, where a function may return a value, or not.

Nothing : Maybe a

No value stored

Just : (x : a) -> Maybe a

A value of type a is stored

data IsJust : Maybe a -> Type

Proof that some Maybe is actually Just

ItIsJust : IsJust (Just x)