[mercury-users] constrained polymorphic mode error

Tom Schrijvers Tom.Schrijvers at cs.kuleuven.ac.be
Sat Aug 10 00:58:26 AEST 2002


Hi again,

Here is another error that puzzles me:

$ mmc cpm_error.m -E
cpm_error.m:031: In clause for `m(in(cpm_error:val_closure(cpm_error:closure_list((X =< ground)))), out(cpm_error:closure_list((X =< ground))))':
cpm_error.m:031:   in argument 1 of call to predicate `cpm_error:eval/2':
cpm_error.m:031:   mode error: variable `CCL' has instantiatedness `cpm_error:val_closure(cpm_error:closure_list((X =< ground)))',
cpm_error.m:031:   expected instantiatedness was `cpm_error:val_closure((V_2 =< ground))'.

$ mmc -v
Mercury Compiler, version rotd-2002-08-05, configured for i686-pc-linux-gnu

As far as I can tell it holds that

  cpm_error:closure_list((X =< ground)) =< ground

so why does the compiler generate this error?

Tom

%%%%%%%%%%%%%%%%%%%%%%%%%%%%
:- module cpm_error.

:- interface.

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

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

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

:- inst closure_list(X)
        == bound( cpm_error__nil
 	        ; cpm_error__list(X,val_closure(closure_list(X)))
 		).
:- implementation.

:- pred eval(val_closure(X),X).
:- mode eval(in(val_closure(X =< ground)),out(X =< ground)) is det.
eval(val_closure(P),X) :-
   call(P,X).

:- pred m(val_closure(closure_list(X)),
	  closure_list(X)).
:- mode m(in(val_closure(closure_list(X =< ground))),
	  out(closure_list(X =< ground))) is det.
m(CCL,RCL) :-
  eval(CCL,RCL).



--------------------------------------------------------------------------
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