[m-users.] Problem with higher-order pred passed as argument

Julien Fischer jfischer at opturion.com
Tue Jan 25 01:46:57 AEDT 2022


On Tue, 25 Jan 2022, Zoltan Somogyi wrote:

> To tell it the modes, you should define an inst such as
>
> :- inst tpu_inst
>    --->    loads(ground)
>    ;       vartype
>    ;       identifier
>    ;       callterm(ground, ground, ground)
>    ;       t_indent(pred(in, out) is det).
>
> and then specify the mode of the Op argument as "in(tpu_inst)".

An alternative to defining the above inst would be to use a combined
higher-order type and inst, see section 8.3.3 of the reference manual.
For example:

     :- type tpu_inst
     --->    loads(ps)
     ;       vartype
     ;       identifier
     ;       callterm(felt_options, int, call_term)
     ;       t_indent(pred(tpu_state::in, tpu_state::out) is det).

Julien.


More information about the users mailing list