.. index:: maybe
.. _maybe/0:

**object**

``maybe``
=========

Types and predicates for type-checking and handling optional term references. Inspired by Haskell.

| **Author:** Paulo Moura
| **Version:** 0.5
| **Date:** 2019/1/24

| **Compilation flags:**
|    ``static, context_switching_calls``


| **Provides:**
|    :ref:`type::type/1 <type/0::type/1>`
|    :ref:`type::check/2 <type/0::check/2>`
|    :ref:`arbitrary::arbitrary/1 <arbitrary/0::arbitrary/1>`
|    :ref:`arbitrary::arbitrary/2 <arbitrary/0::arbitrary/2>`

Public interface
----------------

.. raw:: html

   <div id="cat/2"> </div>

.. index:: cat/2
.. _maybe/0::cat/2:

``cat/2``
^^^^^^^^^

Returns the terms stored in the non-empty references.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``cat(References,Values)``
| **Mode and number of proofs:**
|    ``cat(+list(optional),-list)`` - ``one``


Protected interface
-------------------

(see related entities)

Private predicates
------------------

(see related entities)

Operators
---------

(none)

Remarks
-------

* **Type maybe(Type)**: Allows type-checking optional term references where the optional term must be of the given type.

* **QuickCheck support**: Defines clauses for the arbitrary::arbitrary/1-2 predicates to allow generating random values for the maybe(Type) type.

.. seealso::

   :ref:`optional <optional/0>`, :ref:`optional(Reference) <optional/1>`, :ref:`type <type/0>`, :ref:`arbitrary <arbitrary/0>`

