[GHC] #3908: "Defined but not used" for variable used in Template Haskell splice

GHC trac at galois.com
Wed Mar 3 18:28:19 EST 2010


#3908: "Defined but not used" for variable used in Template Haskell splice
---------------------------------+------------------------------------------
    Reporter:  josh              |       Owner:                                   
        Type:  bug               |      Status:  new                              
    Priority:  normal            |   Component:  Compiler                         
     Version:  6.12.1            |    Keywords:                                   
          Os:  Unknown/Multiple  |    Testcase:                                   
Architecture:  Unknown/Multiple  |     Failure:  Incorrect warning at compile-time
---------------------------------+------------------------------------------
 I encountered this warning on valid code using Template Haskell ; I had to
 change "name" to "_name" to make it compile warning-free.

 Test case:

 {{{
 {-# LANGUAGE FlexibleInstances, TemplateHaskell #-}
 import Language.Haskell.TH

 main :: IO ()
 main = do
     let name = mkName "name"
     decl <- runQ [d| instance Show $(conT name) where show = undefined |]
     print decl
 }}}

 Warnings:
 {{{
 TestCase.hs:6:8: Warning: Defined but not used: `name'
 }}}

 I found ticket #3873, but I don't know if it represents the same bug.

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


More information about the Glasgow-haskell-bugs mailing list