GHCi warnings do not respect the default module header
If I load this program in ghci with -Wall
, I get no warnings:
type T = Int
main :: IO ()
main = return ()
If I add a module header:
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.