For CHR programs of any size, it is clearly impractical to creep through the entire program. Spypoints make it possible to stop the program upon an event of interest. Once there, one can set further spypoints in order to catch the control flow a bit further on, or one can start creeping.
Setting a spypoint on a constraint or a rule indicates that you wish to see all control flow through the various ports involved, except during skips. When control passes through any port with a spypoint set on it, a message is output and the user is asked to interact. Note that the current mode of leashing does not affect spypoints: user interaction is requested on every port.
Spypoints are set and removed by the following predicates, which are declared as prefix operators:
chr_spy
Spec
Sets spypoints on constraints and rules given by Spec, which is is of the form:
already_in_store
is in effect.
already_in_heads
or the corresponding
pragmas are in effect.
Examples:
| ?- chr_spy rules rule(3), transitivity, already_in_store. | ?- chr_spy constraints prime/1.
If you set spypoints, the CHR debugger will be switched on.
chr_nospy
Spec
Removes spypoints on constraints and rules given by Spec,
where Spec is of the form as described for chr_spy
Spec. There is no
chr_nospyall/0
. To remove all CHR
spypoints use chr_nospy _
.
The options available when you arrive at a spypoint are described later. See CHR Debugging Options.