#2356: GHC accepts multiple instances for the same type in different modules
----------------------+-----------------------------------------------------
Reporter: claus | Owner:
Type: bug | Status: new
Priority: high | Milestone: 6.10.1
Component: Compiler | Version: 6.8.2
Severity: normal | Resolution:
Keywords: | Difficulty: Unknown
Testcase: | Architecture: Unknown
Os: Unknown |
----------------------+-----------------------------------------------------
Changes (by chak):
* cc: [EMAIL PROTECTED] (added)
Comment:
Replying to [comment:1 guest]:
> This really surprises me. Why doesn't think produce a link error?
> Each instance declaration should give rise to a global symbol uniquely
determined by the class and the type, I'd presume. And when they meet
there will be a clash.
> Obviously I'm wrong, as this (scary) example shows.
I believe, toplevel symbols binding dictionaries include the module (and
package name) like all other toplevel symbols.
The example -although violating the current language definition- is less
scary than one might think. You cannot abuse it (even if you chuck FDs
into the mix) to coerce types unsafely (or circumvent strong typing in any
other way).
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2356#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs