Node:CHR Debugging Predicates, Next:, Previous:CHR Control Flow Model, Up:CHR Debugging

CHR Debugging Predicates

The following predicates control the operation of the CHR debugger:


Switches the CHR debugger on and ensures that the next time control enters a CHR port, a message will be produced and you will be asked to interact.

At this point you have a number of options. See CHR Debugging Options. In particular, you can just type <RET> to creep (or single-step) into your program. You will notice that the CHR debugger stops at many ports. If this is not what you want, the predicate chr_leash gives full control over the ports at which you are prompted.


Switches the CHR debugger on and ensures that the next time control enters a CHR port with a spypoint set, a message will be produced and you will be asked to interact.


Switches the CHR debugger off. If there are any spypoints set then they will be kept.


Equivalent to chr_nodebug.


Prints onto the standard error stream information about the current CHR debugging state. This will show:

  1. Whether the CHR debugger is switched on.
  2. What spypoints have been set (see below).
  3. What mode of leashing is in force (see below).


The leashing mode is set to Mode. It determines the CHR ports at which you are to be prompted when you creep through your program. At unleashed ports a tracing message is still output, but program execution does not stop to allow user interaction. Note that the ports of spypoints are always leashed (and cannot be unleashed). Mode is a list containing none, one or more of the following port names:

Prompt when a constraint is executed for the first time.
Prompt when the constraint is successfully processed, i.e. the applicable rules have applied.
Prompt at subsequent exits generated by nondeterminate rule bodies.
Prompt when a constraint fails.
Prompt when a constraint from the constraint store is woken and reconsidered because one of its variables has been touched.
Prompt just before the guard evaluation of a rule, after constraints matching the heads have been found.
Prompt upon the application of a rule, after the successful guard evaluation, when the rule commits and fires, just before evaluating the body.
Prompt when a constraint gets inserted into the constraint store, i.e. after all rules have been tried.
Prompt when a constraint gets removed from the constraint store, e.g. when a simplification rule applies.

The initial value of the CHR leashing mode is [call,exit,fail,wake,apply]. Predefined shortcuts are:

chr_leash(none), chr_leash(off)
To turn leashing off.
To prompt at every port.
Same as chr_leash([call,exit,fail,wake,apply]).
No need to use a list if only a singular port is to be leashed.