[Haskell-cafe] GHC's -fwarn-unused-imports ignores function signatures

Nicolas Pouillard nicolas.pouillard at gmail.com
Wed Jan 28 15:22:43 EST 2009


Excerpts from Martijn van Steenbergen's message of Wed Jan 28 17:33:18 +0100 2009:
> This is a bug in GHC. See:
> 
> http://hackage.haskell.org/trac/ghc/ticket/2267
> 
> I have the same problem in several of my source files. :-(


Sometimes swaping the import lists does hide this wrong warning.
Including in this example. 

> Michael Snoyman wrote:
> > I was writing code similar to the following and compiling with "-Wall 
> > -Werror." Clearly I *am* using Data.ByteString for the function signatures.
> > 
> > {-# OPTIONS_GHC -fwarn-unused-imports -Werror #-}
> > import qualified Data.ByteString as B
> > import qualified Data.ByteString.UTF8 as BU
> > 
> > toString :: B.ByteString -> String
> > toString = BU.toString
> > 
> > fromString :: String -> B.ByteString
> > fromString = BU.fromString
> > 
> > main :: IO ()
> > main = putStrLn $ toString $ fromString "Hello World!"
> > 
> > 
> > The warning I get is:
> > 
> > 
> > Unused.hs:2:0:
> >     Warning: Module `Data.ByteString' is imported, but nothing from it 
> > is used,
> >                except perhaps instances visible in `Data.ByteString'
> >              To suppress this warning, use: import Data.ByteString()
> > 
> > 
> > 
> > Am I doing something wrong or is this a bug in GHC?
> > 
> > Thanks,
> > Michael
> > 
> > 
> > ------------------------------------------------------------------------
> > 
> > _______________________________________________
> > Haskell-Cafe mailing list
> > Haskell-Cafe at haskell.org
> > http://www.haskell.org/mailman/listinfo/haskell-cafe
> 

-- 
Nicolas Pouillard


More information about the Haskell-Cafe mailing list