.. index:: single: maybe .. _maybe/0: .. rst-class:: right **object** ``maybe`` ========= Types and predicates for type-checking and handling optional terms. Inspired by Haskell. | **Availability:** | ``logtalk_load(optionals(loader))`` | **Author:** Paulo Moura | **Version:** 0:7:0 | **Date:** 2021-01-03 | **Compilation flags:** | ``static, context_switching_calls`` | **Provides:** | :ref:`type::type/1 ` | :ref:`type::check/2 ` | :ref:`arbitrary::arbitrary/1 ` | :ref:`arbitrary::arbitrary/2 ` | **Uses:** | :ref:`optional ` | :ref:`optional(Optional) ` | :ref:`random ` | :ref:`type ` | **Remarks:** - Type-checking support: Defines type ``maybe(Type)`` for checking optional terms where the value hold by 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. | **Inherited public predicates:** | (none) .. contents:: :local: :backlinks: top Public predicates ----------------- .. index:: cat/2 .. _maybe/0::cat/2: ``cat/2`` ^^^^^^^^^ Returns the values stored in the non-empty optional terms. | **Compilation flags:** | ``static`` | **Template:** | ``cat(Optionals,Values)`` | **Mode and number of proofs:** | ``cat(+list(optional),-list)`` - ``one`` ------------ Protected predicates -------------------- (no local declarations; see entity ancestors if any) Private predicates ------------------ (no local declarations; see entity ancestors if any) Operators --------- (none) .. seealso:: :ref:`optional `, :ref:`optional(Optional) `, :ref:`type `, :ref:`arbitrary `