[mercury-users] Passing a multi-mode higher order predicate
Jeff Thompson
jeff at thefirst.org
Sun Feb 5 16:51:16 AEDT 2012
Hello again. In the program below, the compiler gives the following
error due to "test(list.member)".
test.m:010: In clause for `main(di, uo)':
test.m:010: in argument 1 of call to predicate `test.test'/1:
test.m:010: mode error: variable `V_6' has instantiatedness `free',
test.m:010: expected instantiatedness was `(pred((ground >> ground),
(ground
test.m:010: >> ground)) is semidet)'.
The predicate list.member exists with the correct mode, so why does the
compiler say the argument is free?
:- module test.
:- interface.
:- import_module io.
:- pred main(io__state::di, io__state::uo) is cc_multi.
:- implementation.
:- import_module int, list.
main(!IO) :-
if test(list.member) then io.write_string("yes", !IO) else
io.write_string("no", !IO).
:- pred test(pred(int, list(int))).
:- mode test(pred(in, in) is semidet) is semidet.
test(Pred) :- Pred(1, [1]).
Thanks for any help,
- Jeff
--------------------------------------------------------------------------
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