overlapping instances and constraints
Benjamin.Rudiak-Gould at cl.cam.ac.uk
Tue Feb 28 16:37:29 EST 2006
Claus Reinke wrote:
> most of us would be happy if instance contexts
> would be required to uniquely determine the instance to be
> chosen, a rather conservative extension of current practice.
How would that work? There's no way to prove that
instance (Num a) => Foo a where ...
instance Foo Char where ...
don't overlap, because there's no way to know what instances of Num might be
declared in other modules. If you reason based on what's in scope, you end
up with the same problems that Simon detailed for overlapping instances. I
can't think of any situation where the context could safely be used to
resolve overlap except for a class private to the current module whose
instances are locally constrained, but that doesn't seem like it would be
More information about the Haskell-prime