object

# `expected`

Constructors for expected term references. A reference contains either an expected term or an unexpected term. References should be regarded as opaque terms and always used with the `expected/1` object by passing the reference as a parameter.

Author: Paulo Moura
Version: 1.2
Date: 2019/1/23
Compilation flags:
`static, context_switching_calls`
Provides:
type::type/1
type::check/2
Remarks:

> - Type-checking support: This object also defines a type `expected` for use with the `type` library object.

- Public predicates

  - `of_unexpected/2`

  - `of_expected/2`

  - `from_goal/4`

  - `from_goal/3`

- Protected predicates

- Private predicates

- Operators

## Public predicates

### `of_unexpected/2`

Constructs a reference from an unexpected term.

Compilation flags:
`static`
Template:
`of_unexpected(Unexpected,Reference)`
Mode and number of proofs:
`of_unexpected(@term,--nonvar)` - `one`

### `of_expected/2`

Constructs a reference from an expected term.

Compilation flags:
`static`
Template:
`of_expected(Expected,Reference)`
Mode and number of proofs:
`of_expected(@term,--nonvar)` - `one`

### `from_goal/4`

Constructs a reference by calling `Goal` that binds and holds `Expected` on success. Otherwise returns a reference with the unexpected goal error or failure represented by the `Failure` argument.

Compilation flags:
`static`
Template:
`from_goal(Goal,Expected,Failure,Reference)`
Meta-predicate template:
`from_goal(0,*,*,*)`
Mode and number of proofs:
`from_goal(+callable,--term,@term,--nonvar)` - `one`

### `from_goal/3`

Constructs a reference by calling `Goal` that binds and uses `Expected` on success. Otherwise returns a reference with the unexpected goal error or failure represented by the atom `fail`.

Compilation flags:
`static`
Template:
`from_goal(Goal,Expected,Reference)`
Meta-predicate template:
`from_goal(0,*,*)`
Mode and number of proofs:
`from_goal(+callable,--term,--nonvar)` - `one`

## Protected predicates

(see entity ancestors)

## Private predicates

(see entity ancestors)

## Operators

(none)

See also

expected(Reference), type