[m-users.] Question regarding predicates stored in existential data types.

Peter Wang novalazy at gmail.com
Thu Feb 18 12:14:13 AEDT 2021


On Wed, 17 Feb 2021 16:13:56 -0500 Philip White <philip at pswhite.org> wrote:
> On Wed, 17 Feb 2021 14:23:00 +1100 (AEDT) "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> > Specifically, the mode analyser still gets its
> > information about the modes of the arguments of higher order values
> > only from higher order insts in mode declarations, not from higher order
> > insts in type declarations. This is why you get the error you get.

The limitation (seems to) apply when the constructor has existentially
quantified type variables. A possible workaround would be to add a
constructor without existential variables around the higher order value,
e.g.

    :- type flag(T)
	--->    some [A] map1_flag(A, pred_wrapper(A, T)).

    :- type pred_wrapper(A, T)
	--->    pred_wrapper(pred(A::in, T::out) is det).

I assume this limitation is simply an oversight, but I haven't looked
into the mode checker yet.

Peter


More information about the users mailing list