Maybe
Functions
map

Transforms a maybe value by using the specified mapping function.

Type signature:

<'a,'b,'closure>(||)(('closure)('a) -> 'b, maybe<'a>) -> maybe<'b>
Parameters
f : ('closure)('a) -> 'b

The mapping function

maybeVal : maybe<'a>

The maybe value

Returns

The transformed maybe value.

get

Returns the value associated with the maybe or crashes the program.

Type signature:

<'a>(||)(maybe<'a>) -> 'a
Parameters
maybeVal : maybe<'a>

The maybe value

Returns

The value inside of the maybe.

isJust

Returns true if the maybe value is not nothing

Type signature:

<'a>(||)(maybe<'a>) -> bool
Parameters
maybeVal : maybe<'a>

The maybe value

Returns

true if the maybe value is not nothing, false otherwise

isNothing

Returns true if the maybe value is nothing

Type signature:

<'a>(||)(maybe<'a>) -> bool
Parameters
maybeVal : maybe<'a>

The maybe value

Returns

true if the maybe value is nothing, false otherwise.

count

Returns 0 if the maybe value is nothing, 1 otherwise

Type signature:

<'a>(||)(maybe<'a>) -> uint8
Parameters
maybeVal : maybe<'a>

The maybe value

Returns

The number of items stored in the count

foldl

Evaluates the equivalent of List:foldl for a maybe

Type signature:

<'t,'state,'closure>(||)(('closure)('t, 'state) -> 'state, 'state, maybe<'t>) -> 'state
Parameters
f : ('closure)('t, 'state) -> 'state

The folding function

initState : 'state

The initial state

maybeVal : maybe<'t>

The maybe value

Returns

The final state returned by f

foldr

Evaluates the equivalent of List:foldr for a maybe

Type signature:

<'t,'state,'closure>(||)(('closure)('t, 'state) -> 'state, 'state, maybe<'t>) -> 'state
Parameters
f : ('closure)('t, 'state) -> 'state

The folding function

initState : 'state

The initial state

maybeVal : maybe<'t>

The maybe value

Returns

The final state returned by f

iter

Executes a function for a maybe value

Type signature:

<'a,'closure>(||)(('closure)('a) -> unit, maybe<'a>) -> unit
Parameters
f : ('closure)('a) -> unit

The function to apply to the value

maybeVal : maybe<'a>

The maybe value

Returns

Unit