[GHC] #13839: GHC warnings do not respect the default module header
GHC
ghc-devs at haskell.org
Fri Nov 16 18:41:54 UTC 2018
#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
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Changes (by Feuerbach):
* status: infoneeded => new
Old description:
> 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.
New description:
If I load this program in ghci 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.
If I compile the program instead of loading it in ghci, I correctly get
the warning in both cases.
--
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13839#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list