[mercury-users] ambiguous overloading causes type ambiguity.

Robert Bossy bossy at ccr.jussieu.fr
Mon Apr 30 21:25:07 AEST 2001


> [localhost:mercury/primality/divisors] metaperl% mmc -E --infer-all divisors.m
> divisors.m:010: In clause for predicate `divisors:main/2':
> divisors.m:010:   error: ambiguous overloading causes type ambiguity.
> divisors.m:010:   Possible type assignments include:
> divisors.m:010: V_15 :: string or (pred string)

Sorry, this is entirely my fault, I should have tested the code I posted before. It is because of

>         { W0 = error(Err) },
>         print(io__error_message(Err)), nl
                ^^^^^^^^^^^^^^^^^^^^^^

The compiler can't tell if the highlighted term is the result of function io__error_message/1 (would have type string) or a curried form of io__error_message/2 (would have higher order type pred(string)).

Unambiguated code:

	{ W0 = error(Err),
	  io__error_message(Err,Msg) },
	print(Msg), nl


-- 
sig(Robert,Bossy) :-
      bossy at ccr.jussieu.fr
.
--------------------------------------------------------------------------
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