[m-dev.] Existentially quantified data constructors

Julien Fischer juliensf at csse.unimelb.edu.au
Wed Apr 16 14:18:32 AEST 2008

On Wed, 16 Apr 2008, Ralph Becket wrote:

> Julien Fischer, Wednesday, 16 April 2008:
>>> (don't use equivalence types in instance declarations,
>> There is no such restriction, perhaps this was the one you were
>> referring to?
>> 	The types in an instance declaration must not be abstract types
>> 	which are elsewhere defined as equivalence types.
> Yes, that's the one.
>>> don't repeat variables in instance declarations, instance
>>> variable arguments must be of the form typector(typevar, typevar, ...),
>> The reference manual already gives the reasons for these restrictions,
>> from section 10.2
>> 	These restrictions ensure that there are no overlapping instance
>> 	declarations, i.e. for each typeclass there is at most one instance
>> 	declaration that may be applied to any type (or sequence of types).
> Is this a necessary restriction or an artefact of our implementation?

The latter.  Certain aspects could (probably) be relaxed, e.g.
you could have unwrapped variables as some, although not all, arguments
of an instance head.  Exactly what restrictions could be dropped depend
on the form that any future version of the type class system takes.
(This has been extensively discussed on this list some time in the recent past.)

> Why isn't this rule relaxed with functional dependencies?

I don't see how information from functional dependencies would help

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