Declarations name the constraint handler, its constraints, specify their syntax and use in built-in labeling.
| Declaration | ::= | handler Name. |
| ::= | constraints SpecList. | |
| ::= | operator(Precedence,Associativity,Name). | |
| ::= | label_with Constraint if Guard. |
The optional handler declaration documents the name of the constraint
handler. Currently it can be omitted, but will be useful in future releases for
combining handlers.
The mandatory constraints declaration lists the constraints
defined in the handler. A ``SpecList'' is a list of Name/Arity
pairs for the constraints.
The declaration of a constraint must appear before
the constraint handling rules and ECLiPSe clauses which define it,
otherwise a syntax error is raised.
There can be several constraints declarations.
The optional operator declaration declares an operator, with
the same arguments as op/3 in ECLiPSe. However, while the usual
operator declarations are ignored during compilation from chr to
pl files, the CHR operator declarations are taken into account
(see also the subsection on clauses).
The optional label_with declaration specifies when the
ECLiPSe clauses of a constraint can be used for built-in labeling
(see subsection on labeling).
Example, contd.: The first lines of the minmax handler are declarations:
handler minmax. constraints leq/2, neq/2, minimum/3, maximum/3. operator(700, xfx, leq). operator(700, xfx, neq).