Re: [m-users.] Higher order type with existential quanitfication
Volker Wysk <[email protected]>
| Newsgroups | gmane.comp.lang.mercury.general |
|---|---|
| Message-ID | <[email protected]> |
Am Montag, dem 23.10.2023 um 19:17 +1100 schrieb Zoltan Somogyi: > On 2023-10-22 22:54 +11:00 AEDT, "Volker Wysk" <[email protected]> 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. No, it should take an existentially quantified value as its input argument and return a normal value. This input argument needs to have a typeclass constraint. I want the predicate to be applied to all members of a heterogenous list. The (non-existential) results are to be collected and returned as an ordinary list. > > > 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. See above. Cheers, Volker _______________________________________________ users mailing list [email protected] https://lists.mercurylang.org/listinfo/users