[GHC] #4912: No warnings for orphan instances declared via TypeSynonymInstances

GHC cvs-ghc at haskell.org
Fri Jan 21 10:00:10 CET 2011


#4912: No warnings for orphan instances declared via TypeSynonymInstances
---------------------------------+------------------------------------------
    Reporter:  batterseapower    |       Owner:                                   
        Type:  bug               |      Status:  new                              
    Priority:  normal            |   Component:  Compiler                         
     Version:  7.0.1             |    Keywords:                                   
    Testcase:                    |   Blockedby:                                   
          Os:  Unknown/Multiple  |    Blocking:                                   
Architecture:  Unknown/Multiple  |     Failure:  Incorrect warning at compile-time
---------------------------------+------------------------------------------
 File Classes.hs:

 {{{
 module Classes where

 data TheirData = TheirData

 class Foo a where
     foo :: a -> a

 class Bar a where
     bar :: a -> String
 }}}

 File Orphans.hs:

 {{{
 {-# LANGUAGE TypeSynonymInstances #-}
 module Orphans where

 import Classes


 type OurData = TheirData

 instance Foo TheirData where
     foo = id

 instance Bar OurData where
     bar _ = "Ours"
 }}}

 Compile:

 {{{
 $ ghc --make -fforce-recomp -fwarn-orphans Orphans.hs
 [1 of 2] Compiling Classes          ( Classes.hs, Classes.o )
 [2 of 2] Compiling Orphans          ( Orphans.hs, Orphans.o )

 Orphans.hs:9:10: Warning: orphan instance: instance Foo TheirData
 }}}

 This is not my expected result. We should get orphan instance warnings for
 Bar OurData  as well, since OurData is just a thinly-disguised version of
 TheirData.

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



More information about the Glasgow-haskell-bugs mailing list