Library with some operations for encapsulating search.
Note that some of these operations are not fully declarative,
i.e., the results depend on the order of evaluation and program rules.
There are newer and better approaches the encapsulate search,
in particular, set functions (see module SetFunctions
),
which should be used.
In previous versions of PAKCS, some of these operations were part of the standard prelude. We keep them in this separate module in order to support a more portable standard prelude.
Author: Michael Hanus
Version: December 2018
getAllValues
:: a > IO [a]
Gets all values of an expression (currently, via an incomplete depthfirst strategy). 
getSomeValue
:: a > IO a
Gets a value of an expression (currently, via an incomplete depthfirst strategy). 
allValues
:: a > [a]
Returns all values of an expression (currently, via an incomplete depthfirst strategy). 
someValue
:: a > a
Returns some value for an expression (currently, via an incomplete depthfirst strategy). 
oneValue
:: a > Maybe a
Returns just one value for an expression (currently, via an incomplete depthfirst strategy). 
allSolutions
:: (a > Bool) > [a]
Returns all values satisfying a predicate, i.e., all arguments such that the predicate applied to the argument can be evaluated to True
(currently, via an incomplete depthfirst strategy).

someSolution
:: (a > Bool) > a
Returns some values satisfying a predicate, i.e., some argument such that the predicate applied to the argument can be evaluated to True
(currently, via an incomplete depthfirst strategy).

isFail
:: a > Bool
Does the computation of the argument to a headnormal form fail? Conceptually, the argument is evaluated on a copy, i.e., even if the computation does not fail, it has not been evaluated. 
Gets all values of an expression (currently, via an incomplete depthfirst strategy). Conceptually, all values are computed on a copy of the expression, i.e., the evaluation of the expression does not share any results. In PAKCS, the evaluation suspends as long as the expression contains unbound variables. Similar to Prolog's findall. 
Gets a value of an expression (currently, via an incomplete depthfirst strategy). The expression must have a value, otherwise the computation fails. Conceptually, the value is computed on a copy of the expression, i.e., the evaluation of the expression does not share any results. In PAKCS, the evaluation suspends as long as the expression contains unbound variables. 
Returns all values of an expression (currently, via an incomplete depthfirst strategy). Conceptually, all values are computed on a copy of the expression, i.e., the evaluation of the expression does not share any results. In PAKCS, the evaluation suspends as long as the expression contains unbound variables. Note that this operation is not purely declarative since the ordering of the computed values depends on the ordering of the program rules. 
Returns some value for an expression (currently, via an incomplete depthfirst strategy). If the expression has no value, the computation fails. Conceptually, the value is computed on a copy of the expression, i.e., the evaluation of the expression does not share any results. In PAKCS, the evaluation suspends as long as the expression contains unbound variables. Note that this operation is not purely declarative since the computed value depends on the ordering of the program rules. Thus, this operation should be used only if the expression has a single value. 
Returns just one value for an expression (currently, via an incomplete
depthfirst strategy). If the expression has no value, Note that this operation is not purely declarative since the computed value depends on the ordering of the program rules. Thus, this operation should be used only if the expression has a single value. 
Returns all values satisfying a predicate, i.e., all arguments such that
the predicate applied to the argument can be evaluated to Note that this operation is not purely declarative since the ordering of the computed values depends on the ordering of the program rules. 
Returns some values satisfying a predicate, i.e., some argument such that
the predicate applied to the argument can be evaluated to Note that this operation is not purely declarative since the ordering of the computed values depends on the ordering of the program rules. Thus, this operation should be used only if the predicate has a single solution. 
Does the computation of the argument to a headnormal form fail? Conceptually, the argument is evaluated on a copy, i.e., even if the computation does not fail, it has not been evaluated. 