[mercury-users] Type error in higher-order predicate and existential type

Fran├žois Degrave fde at info.fundp.ac.be
Tue Nov 6 02:06:33 AEDT 2007

Dear all,

Using a higher-order predicate, I get an type error and I don't 
understand where it comes from. Here is a much simplified version of the 
predicate I wrote :

:- pred higher_order_pred(pred(T,T),T).
:- mode higher_order_pred(in(pred(in, out) is semidet),out) is semidet.
higher_order_pred(HOPred,Result) :- call(HOPred,5,Result).

And here's the error returned by the compiler :

reordering.m:023: In clause for predicate `reordering.higher_order_pred/2':
reordering.m:023:   in argument 2 (i.e. argument 1 of the called 
predicate) of higher-order predicate call:
reordering.m:023:   type error: argument has type `int',
reordering.m:023:   expected type was `(some [T] T)'.

Where does this existential type (some [T] T) come from? And what should 
I change in what I wrote to make it OK?

Thank you in advance,



mercury-users mailing list
Post messages to:       mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions:          mercury-users-request at csse.unimelb.edu.au

More information about the users mailing list