[GHC] #5211: Missing warning about redundant import for a class instance

GHC cvs-ghc at haskell.org
Mon May 23 19:43:48 CEST 2011


#5211: Missing warning about redundant import for a class instance
---------------------------------+------------------------------------------
    Reporter:  Lemming           |       Owner:              
        Type:  bug               |      Status:  new         
    Priority:  normal            |   Component:  Compiler    
     Version:  6.12.3            |    Keywords:              
    Testcase:                    |   Blockedby:              
          Os:  Unknown/Multiple  |    Blocking:              
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown
---------------------------------+------------------------------------------
 I have the following module
 {{{
 module RedundantImport where

 -- this import is redundant, but GHC does not spot it
 import qualified Foreign.Storable as St

 import Foreign.Storable (Storable, sizeOf, alignment, peek, poke, )
 import Foreign.Ptr (castPtr, )


 newtype T a = Cons a


 instance Storable a => Storable (T a) where
    sizeOf (Cons a) = sizeOf a
    alignment (Cons a) = alignment a
    peek = fmap Cons . peek . castPtr
    poke p (Cons a) = poke (castPtr p) a
 }}}

 If loaded into GHCi with -Wall option, then GHCi does not give a warning,
 although the first import is redundant.
 It might have to do with the way how GHC accepts unqualified method names
 in instance implementations although the concerned method names are only
 imported in a qualified way.

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



More information about the Glasgow-haskell-bugs mailing list