.. index:: either
.. _either/0:

**object**

``either``
==========

Types and predicates for extended type-checking of expected term references and for handling lists of expected term references.

| **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="expecteds/2"> </div>

.. index:: expecteds/2
.. _either/0::expecteds/2:

``expecteds/2``
^^^^^^^^^^^^^^^

Returns the terms stored in the references that hold an expected term.

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

| **Template:**
|    ``expecteds(References,Expecteds)``
| **Mode and number of proofs:**
|    ``expecteds(+list(expected),-list)`` - ``one``


.. raw:: html

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

.. index:: unexpecteds/2
.. _either/0::unexpecteds/2:

``unexpecteds/2``
^^^^^^^^^^^^^^^^^

Returns the terms stored in the references that hold an expected term.

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

| **Template:**
|    ``unexpecteds(References,Unexpecteds)``
| **Mode and number of proofs:**
|    ``unexpecteds(+list(expected),-list)`` - ``one``


.. raw:: html

   <div id="partition/3"> </div>

.. index:: partition/3
.. _either/0::partition/3:

``partition/3``
^^^^^^^^^^^^^^^

Retrieves and partitions the terms hold by the references.

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

| **Template:**
|    ``partition(References,Expecteds,Unexpecteds)``
| **Mode and number of proofs:**
|    ``partition(+list(expected),-list,-list)`` - ``one``


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

(see related entities)

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

(see related entities)

Operators
---------

(none)

Remarks
-------

* **Type either(ExpectedType, UnexpectedType)**: Allows type-checking expected references where the expected and unexpected terms must be of the given types.

* **QuickCheck support**: Defines clauses for the type::arbitrary/1-2 predicates to allow generating random values for the either(ExpectedType, UnexpectedType) type.

.. seealso::

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

