[mercury-users] typeclass / collections / unexplainable behaviour

Mark Brown mark at csse.unimelb.edu.au
Mon Oct 16 18:02:42 AEST 2006


Hi Nick,

Thanks for reporting this.  Unfortunately, you've hit one of the nasty
restrictions in Mercury's implementation of typeclasses:

On 16-Oct-2006, Jrg Roman Rudnick <joerg.rudnick at t-online.de> wrote:
> :-instance fringeW(queue(T), wrapper(T)) <= fringeNode(T) where [

As mentioned near the start of section 10.2 of the reference manual,
the types appearing in instances must be constructors with distinct type
variables as arguments.  The problem here is that T is not distinct -- it
appears twice in the arguments of fringeW/2.

We'd really like to lift this restriction, but it's deeply built into the
implementation and is not likely to be lifted any time soon.

The compiler really should be reporting this error properly.  That's a
compiler bug (and I'm surprised we haven't noticed this before, since the
code that is supposed to do this check has been there for a long time).
We can at least fix the error reporting without too much trouble.

Hope that helps.

Cheers,
Mark.

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