Description

The maybe type encapsulates an optional value. When a value is present, we have just(Value). When it's absent we have nothing. In some circumstances, this can be a more natural model than using Prolog failure. For example, one might model a nullable SQL column using maybe.

This module draws inspiration from similar libraries for Mercury and Haskell. We make predicates available even where it's clearer to use unification. That facilitates using maybe values with maplist and friends.

In addition to the predicates described below, this module defines clauses for the multifile predicate error:has_type/2 which describe the type maybe and maybe(T) where T is a type parameter. It also defines clauses for working with library(quickcheck).