Maybe

A type representing computations that may fail.

Atoms

Some value

A value.

Arguments:

  • value: The contained value in the maybe.

Methods

maybe

Applies the provided function to the contained value if it exists,

otherwise returning the provided default value.

Arguments: - default: The value to return if `this` is Nothing. This value is lazy

and hence will not execute any provided computation unless it is used.
- function: The function to execute on the value inside the `Just`, if it
is a just.

Example
Apply a function over a Just value to get 4.
(Just 2).maybe 0 *2

maybe ~default function

is_just

Check if the maybe value is Just.

Example
Check if Nothing is Just.
Nothing.is_just

is_just

is_nothing

Check if the maybe value is Nothing.

Example
Check if Nothing is Nothing.
Nothing.is_nothing

is_nothing

Chapter 'community'
100% - 100vh
Get the latest updates
to your email.

Join the Community!

Enso is a community-driven open source project which is, and will always be, open and free to use. Join us, help us to build it, and spread the word!