CHR Spypoints

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:

_ (variable)
denoting all constraints and rules, or:
constraints Cs
where Cs is one of

_ (variable)
denoting all constraints
C,...,C
denoting a list of constraints C
Name
denoting all constraints with this functor, regardless of arity
Name/Arity
denoting the constraint of that name and arity

rules Rs
where Rs is one of:

_ (variable)
denoting all rules
R,...,R
denoting a list of rules R
Name
where Name is the name of a rule in any handler.
already_in_store
The name of a rule implicitly defined by the system when the option already_in_store is in effect.
already_in_heads
The name of a rule implicitly defined by the system when the option already_in_heads or the corresponding pragmas are in effect.
Handler:Name
where Handler is the name of a constraint handler and Name is the name of a rule in that handler

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.