[GHC] #5820: defining instance in GHCi leads to duplicated instances

GHC cvs-ghc at haskell.org
Fri Jan 27 21:56:42 CET 2012


#5820: defining instance in GHCi leads to duplicated instances
------------------------------+---------------------------------------------
 Reporter:  guest             |          Owner:                  
     Type:  bug               |         Status:  new             
 Priority:  normal            |      Component:  GHCi            
  Version:  7.4.1-rc1         |       Keywords:                  
       Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
  Failure:  None/Unknown      |       Testcase:                  
Blockedby:                    |       Blocking:                  
  Related:                    |  
------------------------------+---------------------------------------------
 Bizarre:

 {{{
 claude at jazzyjeff:~$ cat Foo.hs
 module Foo where
 data Foo = Foo
 instance Num Foo where
 claude at jazzyjeff:~$ ~/opt/ghc-7.4/bin/ghci -w Foo.hs
 GHCi, version 7.4.0.20120119: http://www.haskell.org/ghc/  :? for help
 Loading package ghc-prim ... linking ... done.
 Loading package integer-gmp ... linking ... done.
 Loading package base ... linking ... done.
 [1 of 1] Compiling Foo              ( Foo.hs, interpreted )
 Ok, modules loaded: Foo.
 *Foo> :info Foo
 data Foo = Foo  -- Defined at Foo.hs:2:6
 instance Num Foo -- Defined at Foo.hs:3:10
 *Foo> instance Fractional Foo where
 *Foo> :info Foo
 data Foo = Foo  -- Defined at Foo.hs:2:6
 instance Fractional Foo -- Defined at <interactive>:3:10
 instance Num Foo -- Defined at Foo.hs:3:10
 instance Num Foo -- Defined at Foo.hs:3:10
 }}}

 I get an extra Num instance (where from? same source location??), which
 causes overlapping problems.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5820>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the Glasgow-haskell-bugs mailing list