Keith Wansbrough wrote:
> 
> > > You can now see that the two instance declarations overlap: their
> > > right hand sides are in fact *identical*.  Remember that the
> > > typechecker simply matches on the right-hand sides ("heads") of the
> > > instance declarations.
> > No they do not overlap, unless there is an a b satisfying NodeTypeConfigParms a b
> > and ArcTypeConfigParms a b.  Which there aint.
> 
> Haskell makes the "open world" assumption... there may be new
> instances added later, and the behaviour of a well-typed program
> should not change if this occurs.
> 
> I'll defer further discussion of this to the experts (Mark Jones?).
I think I've worked out what's going on now.  But I don't like it.  
When I use -fallow-undecidable-instances and -fallow-overlapping-instances
(as I did) I was assuming (like Keith Wansbrough did) that GHC would do a 
Prolog-style backtracking search when it was time to resolve an overloading,
and would only complain if there were more or fewer than one chain of inferences.
Instead Haskell eagerly tries to anticipate possible conflicts, which is a nuisance
when it is obvious (as it is to me in this case) that such conflicts are unlikely
to arise.  For a simpler example, imagine that we have two classes
Integral a (things corresponding to integers) and String a (things corresponding to
strings).  It is a pity that we cannot write

instance Integral a => Show a
   and
instance String a => Show a

just because someone may come along later on and try to show something which is an
instance of both Integral and String.  (Though obviously if they do, we DO need an
error message.)

_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to