#2356: GHC accepts multiple instances for the same type in different modules
----------------------+-----------------------------------------------------
 Reporter:  claus     |          Owner:         
     Type:  bug       |         Status:  new    
 Priority:  low       |      Milestone:  _|_    
Component:  Compiler  |        Version:  6.8.2  
 Severity:  normal    |     Resolution:         
 Keywords:            |     Difficulty:  Unknown
 Testcase:            |   Architecture:  Unknown
       Os:  Unknown   |  
----------------------+-----------------------------------------------------
Changes (by simonpj):

  * priority:  high => low
  * milestone:  6.10.1 => _|_

Comment:

 Currently this is by design.  What would the unique global symbol be for
 {{{
   instance C (T a) [Maybe b]
 }}}
 Oh, and `T` might be a type synonym.

 We could encode the type as a string, I suppose, but the error message
 (from the linker) would still be execrable.

 For indexed-type instances, overlap is unsound, so there's an eager check.

 On reflection, if you don't use `-fallow-overlapping-instances` GHC should
 arguably do the same eager check for class instances; that would more
 faithfully implement the Report.  Even doing that is not trivial, because
 GHC goes to some lengths to avoid looking at (literally) thousands of
 interface files on every compilation, just on the off-chance that there'll
 be an instance declaration lurking there.

 With overlap allowed, it's clear that you can make different choices in
 different parts of the program.

 So I'm not sure what to do; and the only thing that comes to mind isn't
 cheap.  For now I'll put it as low-prio, unless people start yelling that
 it's ruining their day.

 Simon

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2356#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to