Skip to content

defining instance in GHCi leads to duplicated instances

Bizarre:

claude@jazzyjeff:~$ cat Foo.hs 
module Foo where
data Foo = Foo
instance Num Foo where
claude@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.

Trac metadata
Trac field Value
Version 7.4.1-rc1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component GHCi
Test case
Differential revisions
BlockedBy
Related
Blocking
CC claudiusmaximus@goto10.org
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information