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.

Summary

Functions

Instantiates Data.Maybe value containing v of type term

Instantiates an “empty” Data.Maybe value

Types

t :: %Data.Maybe{just: term, nothing: boolean}

Functions

just(v)

Specs

just(term) :: t

Instantiates Data.Maybe value containing v of type term.

nothing()

Specs

nothing :: t

Instantiates an “empty” Data.Maybe value.