[GHC] #13839: GHC warnings do not respect the default module header

GHC ghc-devs at haskell.org
Sat Jun 17 08:09:28 UTC 2017


#13839: GHC warnings do not respect the default module header
-------------------------------------+-------------------------------------
           Reporter:  Feuerbach      |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 If I compile this program with `-Wall`, I get no warnings:


 {{{#!hs
 type T = Int

 main :: IO ()
 main = return ()
 }}}

 If I add a module header:

 {{{#!hs
 module Main(main) where

 type T = Int

 main :: IO ()
 main = return ()
 }}}

 I now get a warning:

 {{{
 ghcbug2.hs:3:1: warning: [-Wunused-top-binds]
     Defined but not used: type constructor or class ‘T’
 }}}

 Yet, according to Haskell2010 (section 5.1):

 > An abbreviated form of module, consisting only of the module body, is
 permitted. If this is used, the header is assumed to be ‘module Main(main)
 where’.

 Therefore, the right behaviour should be to print a warning in the first
 case as well.

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


More information about the ghc-tickets mailing list