[m-dev.] Type class instance constraints

Ralph Becket rafe at csse.unimelb.edu.au
Tue May 22 13:05:47 AEST 2007


We currently have a number of restrictions on what can appear in an
instance declaration, namely that

- each parameter takes the form type_name(TypeVar1, TypeVar2, ...)
- all TypeVars are distinct.

These restrictions are there to prevent ambiguity with overlapping
instance declarations.  In practice we can only check for overlapping
instance declarations in different modules at link-time.  Given that
is the case, why can't we lift both restrictions and simply check for
ambiguity at link time?  It would make the type class system much more
useful.  Currently the first restriction means you have to define no-tag
types all over the place and the second restriction prevents much useful
polymorphism.

-- Ralph
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at csse.unimelb.edu.au
Administrative Queries: owner-mercury-developers at csse.unimelb.edu.au
Subscriptions:          mercury-developers-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the developers mailing list