[mercury-users] errors with typeclasses

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Nov 3 03:40:23 AEDT 2000


On 01-Nov-2000, Ralph Becket <rbeck at microsoft.com> wrote:
> > gusga.m:083: In clause for type class method implementation:
> > gusga.m:083:   in argument 2 of call to predicate `list_add_chromosome/3':
> > gusga.m:083:   type error: variable `HeadVar__2' has type `C1',
> > gusga.m:083:   expected type was `D'.
> > For more information, try recompiling with `-E'.
> 
> DEVELOPERS: this error message looks misleading - I can't see
> any predicate *calls* involved.

So what error message would you like for this example?

For type class method implementations, we treat e.g.

	:- instance foo(bar) where [
		pred(baz/3) is quux
	].

as just an abbreviation for

	:- instance foo(bar) where [
		baz(A,B,C) :- quux(A,B,C)
	].

So there's no explicit call, but there's an implicit call.

It would not be hard to change the error message to "in argument N of
implicit call to predicate ..." or to just "in argument of predicate ...".

gusga.m:083: In clause for type class method implementation:
gusga.m:083:   in argument 2 of predicate `list_add_chromosome/3':
gusga.m:083:   type error: variable `HeadVar__2' has type `C1',
gusga.m:083:   expected type was `D'.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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