[bitc-dev] RE: Type Classes and Specialization

Jonathan S. Shapiro shap at eros-os.org
Mon Jul 25 11:11:39 EDT 2005


On Sun, 2005-07-24 at 22:16 -0700, Mark P Jones wrote:

> Some implementations of Haskell support "overlapping" instances, which
> means that the compiler allows instances to overlap with one another...
> Thus
> 
>   instance TC [a] where ...
>   instance TC [Char] where ...

So we have established from another email that if TC [a] has been
imported, but TC [Char] has not, it is possible to see situations where
we might have a something of type [Char] get treated as something of
type ['a].

It appears to me that in order for this situation to occur, we must have
declarations in scope for both TC and also for Char.

Q1: Am I correct?

If so, then this provides sufficient information for us to know that we
are *looking* for a resolution specialized for Char, but it is *not*
always sufficient to tell us what the best (globally) specialization
would be. It may, however, be sufficient to let us generate a link-time
error if we are a bit clever with name mangling.

shap





More information about the bitc-dev mailing list