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:
already_in_storeis in effect.
already_in_headsor the corresponding pragmas are in effect.
| ?- 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_spySpec. There is no
chr_nospyall/0. To remove all CHR spypoints use
The options available when you arrive at a spypoint are described later. See CHR Debugging Options.