control v0.1.0 Data.Maybe

The Data.Maybe type encapsulates an optional value.

A value of type Data.Maybe<a> either contains a value of type a (represented as just(a)), or it is empty (represented as nothing). Using Data.Maybe is a good way to deal with errors or exceptional cases without resorting to drastic measures such as error.

The Data.Maybe type is also a monad. It is a simple kind of error monad, where all errors are represented by nothing. A richer error monad can be built using the Data.Either type.

Link to this section Summary

Functions

Instantiates Data.Maybe value containing v of type term

Instantiates an “empty” Data.Maybe value

Link to this section Types

Link to this type t()
t() :: %Data.Maybe{just: term(), nothing: boolean()}

Link to this section Functions

Link to this function just(v)
just(term()) :: t()

Instantiates Data.Maybe value containing v of type term.

Link to this function nothing()
nothing() :: t()

Instantiates an “empty” Data.Maybe value.