Constraint Handling Rules (CHR) is a rule-based language to specify application-oriented constraint solvers. In order to use such solvers also in Curry, there is an approach to embed the definition of CHR also in Curry programs. This paper describes the conceptual ideas of this embedding.
In order to compile a Curry/CHR specification,
load the CHR specification into the
compileCHR targetmodule chrrulelist,
targetmodule is the name of the target module to
be generated and
chrrulelist is a list of constraint handling
rules defining the solver.
boolCHR.curry are two examples
containing the definition of a solver for a less-or-equal constraint
and a solver for Boolean constraints, respectively.
For instance, these solvers can be compiled by the shell commands
pakcs -r leqCHR" or "
pakcs -r boolCHR"
> pakcs -l Bool ... Bool> and x y z & neg False z where x,y,z free Free variables in goal: x, y, z Result: success Bindings: x=True y=True z=True
Important note: This is a first prototype to demonstrate the possibility to integrate CHR into Curry. Thus, it does not implement the full functionality of CHR. Furthermore, it is possible that the general concept might be extended or changed in a future version.