"S.D.Mechveliani" wrote:

> > That is, f receives a dictionary of Eq methods on the type a, as
> > specified in its type. It builds a dictionary of Eq methods on the
> > type Maybe a itself, but the fact that it uses instance Eq (Maybe a)
> > is not visible outside.
>
> No. Probably, here how it should be.
> Seeing                               `Just x1 == Just x2'
> the compiler extends *silently* the context for  f:
>

You are essentially suggesting that contexts should be optional when giving a
signature to a function.  This is an interesting idea, but essentially
orthogonal to overlapping instances.  I.e., making signature contexts optional
would in this case make overlapping instances more convenient, and that's all.

I'm not willing to have this be the default behavior for Haskell, but others
have already proposed that the programmer be allowed to use a wildcard
(perhaps `...') in signature contexts to mean `and whatever else is
inferred'.  If you didn't want to be bothered to figure out the correct
context, you'd just write:
    f :: ... => [a] -> [a]

I'll respond to other bits of this long note separately.

--Jeff


Reply via email to