object
expected(Expected)
Expected term predicates. Requires passing an expected term (constructed using the expected object predicates) as a parameter.
static, context_switching_callsPublic predicates
is_expected/0
True if the expected term holds a value. See also the if_expected/1 predicate.
staticis_expected - zero_or_oneis_unexpected/0
True if the expected term holds an error. See also the if_unexpected/1 predicate.
staticis_unexpected - zero_or_oneif_expected/1
Applies a closure when the expected term holds a value using the value as argument. Succeeds otherwise.
staticif_expected(Closure)if_expected(1)if_expected(+callable) - zero_or_moreif_unexpected/1
Applies a closure when the expected term holds an error using the error as argument. Succeeds otherwise. Can be used to throw the exception hold by the expected term by calling it the atom throw.
staticif_unexpected(Closure)if_unexpected(1)if_unexpected(+callable) - zero_or_moreif_expected_or_else/2
Applies either ExpectedClosure or UnexpectedClosure depending on the expected term holding a value or an error.
staticif_expected_or_else(ExpectedClosure,UnexpectedClosure)if_expected_or_else(1,1)if_expected_or_else(+callable,+callable) - zero_or_moreunexpected/1
Returns the error hold by the expected term. Throws an error otherwise.
staticunexpected(Error)unexpected(--term) - one_or_errorexistence_error(unexpected_error,Expected)expected/1
Returns the value hold by the expected term. Throws an error otherwise.
staticexpected(Value)expected(--term) - one_or_errorexistence_error(expected_value,Expected)map/2
When the expected term does not hold an error and mapping a closure with the expected value and the new value as additional arguments is successful, returns an expected term with the new value. Otherwise returns the same expected term.
staticmap(Closure,NewExpected)map(2,*)map(+callable,--nonvar) - oneflat_map/2
When the expected term does not hold an error and mapping a closure with the expected value and the new expected term as additional arguments is successful, returns the new expected term. Otherwise returns the same expected term.
staticflat_map(Closure,NewExpected)flat_map(2,*)flat_map(+callable,--nonvar) - oneeither/3
Applies either ExpectedClosure if the expected term holds a value or UnexpectedClosure if the expected term holds an error. Returns a new expected term if the applied closure is successful. Otherwise returns the same expected term.
staticeither(ExpectedClosure,UnexpectedClosure,NewExpected)either(2,2,*)either(+callable,+callable,--nonvar) - oneor_else/2
Returns the value hold by the expected term if it does not hold an error or the given default term if the expected term holds an error.
staticor_else(Value,Default)or_else(--term,@term) - oneor_else_get/2
Returns the value hold by the expected term if it does not hold an error. Otherwise applies a closure to compute the expected value. Throws an error when the expected term holds an error and a value cannot be computed.
staticor_else_get(Value,Closure)or_else_get(*,1)or_else_get(--term,+callable) - one_or_errorexistence_error(expected_value,Expected)or_else_call/2
Returns the value hold by the expected term if it does not hold an error. Calls a goal deterministically otherwise.
staticor_else_call(Value,Goal)or_else_call(*,0)or_else_call(--term,+callable) - zero_or_oneor_else_throw/1
Returns the value hold by the expected term if present. Throws the error hold by the expected term as an exception otherwise.
staticor_else_throw(Value)or_else_throw(--term) - one_or_erroror_else_fail/1
Returns the value hold by the expected term if it does not hold an error. Fails otherwise. Usually called to skip over expected terms holding errors.
staticor_else_fail(Value)or_else_fail(--term) - zero_or_oneProtected predicates
(none)
Private predicates
(none)
Operators
(none)
See also