[mercury-users] mode error

Tom Schrijvers Tom.Schrijvers at cs.kuleuven.ac.be
Fri Aug 9 19:55:59 AEST 2002


Hi,

I get this strange mode error. The inferred and expected instantiatedness
are identical, so I have no clue about what's wrong.

$ mmc error.m
error.m:037: In clause for `m(in(error:val_closure((error:closure_list))), out((error:closure_list)))':
error.m:037:   in argument 1 of call to predicate `error:eval/2':
error.m:037:   mode error: variable `CCL' has instantiatedness `bound(error:val_closure((pred((free -> (error:closure_list))) is det)))',
error.m:037:   expected instantiatedness was                   `bound(error:val_closure((pred((free -> (error:closure_list))) is det)))'.
For more information, try recompiling with `-E'.

Could anyone please tell me what I'm doing wrong?

Thanks,

Tom

Here is the code:
%%%%%%%%%%%%%%%%%%%%
:- module error.

:- interface.

:- import_module io.

:- pred main(io__state,io__state).
:- mode main(di,uo) is det.

:- implementation.

:- type val_closure(X)
        ---> val_closure(pred(X)).

:- inst val_closure(X)
        == bound( val_closure(pred(out(X)) is det) ).

:- pred eval(val_closure(X),X).
%:- mode eval(in(val_closure(closure_list)),out(closure_list)) is det.
:- mode eval(in(bound(val_closure((pred((free -> (closure_list))) is det)))),
             out(closure_list)) is det.
eval(val_closure(P),X) :-
   call(P,X).

:- type closure_list(X)
        ---> nil
	;    list(X,val_closure(closure_list(X))).

:- inst closure_list
        == bound( nil
	        ; list(ground,val_closure(closure_list))
		).

:- pred m(val_closure(closure_list(X)),closure_list(X)).
:- mode m(in(val_closure(closure_list)),out(closure_list)) is det.
m(CCL,CL) :-
   eval(CCL,CL).

main -->
	 io__write_string("Hello World"),
	 io__nl
	 .

--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list