[m-users.] Higher order type with existential quanitfication

Zoltan Somogyi zoltan.somogyi at runbox.com
Mon Oct 23 19:17:05 AEDT 2023


On 2023-10-22 22:54 +11:00 AEDT, "Volker Wysk" <post at volker-wysk.de> wrote:
> I have a predicate which takes an existentially quantified type as one of
> its arguments.

By this, I presume you mean a predicate that *returns*
a value of an existentially quantified type.

> This predicate I want to pass to another predicate. I'm
> puzzled about how to declare this.

You can't; Mercury does not support this. What you can do instead
is wrap up the existentially typed output value in a function symbol,
using a type like this:

:- type het
   --->    some [T] het(T) => att(T).

You should be able to use a predicate that returns a value of this type
to construct a hetlist.

Zoltan.


More information about the users mailing list