[GHC] #8338: Incoherent instances without -XIncoherentInstances

GHC ghc-devs at haskell.org
Fri Sep 20 22:34:00 CEST 2013


#8338: Incoherent instances without -XIncoherentInstances
------------------------------------+-------------------------------------
       Reporter:  goldfire          |             Owner:
           Type:  bug               |            Status:  new
       Priority:  normal            |         Milestone:
      Component:  Compiler          |           Version:  7.6.3
       Keywords:                    |  Operating System:  Unknown/Multiple
   Architecture:  Unknown/Multiple  |   Type of failure:  None/Unknown
     Difficulty:  Unknown           |         Test Case:
     Blocked By:                    |          Blocking:
Related Tickets:                    |
------------------------------------+-------------------------------------
 Consider the following 4 modules:

 {{{
 {-# LANGUAGE GADTs #-}

 module A where

 data One = One

 data ShowInstFor a = Show a => MkSIF

 incoherent :: ShowInstFor One -> ShowInstFor One -> String
 incoherent MkSIF MkSIF = show One
 }}}

 {{{
 module B where

 import A

 instance Show One where
   show _ = "from module B"

 fromB :: ShowInstFor One
 fromB = MkSIF
 }}}

 {{{
 module C where

 import A

 instance Show One where
   show _ = "from module C"

 fromC :: ShowInstFor One
 fromC = MkSIF
 }}}

 {{{
 module D where

 import A
 import B
 import C

 oops1 = incoherent fromB fromC
 oops2 = incoherent fromC fromB
 }}}

 According to ghci, `oops1` is `"from moduleB"` and `oops2` is `"from
 module C"`. This seems bad.

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



More information about the ghc-tickets mailing list