> I'm happy with either of the following choices:
> 
> * Class constraints on constructors have effect everywhere 
> (as in Hugs).
> * Class constraints on constructors are eliminated (call it a 
> typo if you must).

I'd be delighted to eliminate them, but we had a long H98 debate 
about it (under John's chairmanship) and decided to keep them.

It depends what you mean by "have an effect everywhere".  That's what
I thought GHC implemented!   The effect you wanted is:
 
> It may help if I explain my motivation in introducing class 
> constraints
> in data declarations.  Often, a type will make no sense without the
> constraints; e.g., an association list type Alist a b makes no sense
> unless Eq a holds.  The class constraints on data declarations were a
> simple way for the user to ask the compiler to enforce this invariant.

        When you *construct* a value, the overloaded constructor's
        type does indeed ensure that you can't build it if the invariant
        does not hold.

        But when you take a constructor *apart*, the invariant must hold
        by construction: you couldn't have built the thing you are taking
        apart unless invariant held.  So enforcing the invariant again is
        redundant; and in addition it pollutes the type of selectors.

So doesn't my proposal give you precisely what you want, and no more?

Simon



Reply via email to