Skip to content

Fix #13839: GHCi warnings do not respect the default module header

Roland Senn requested to merge RolandSenn/ghc:T13839_2 into master

Goal: When there is no explicit module header ticket #13839 requests the same unused warning messages for GHC and GHCi when using -Wall. Remaining difference: If there is no module header and no main function, GHC should still issue the error The IO action ‘main’ is not defined in module ‘Main’ . However GHCi should not issue this error and also not show any Defined but not used warnings.

Changes in compiler/typecheck/TcRnExports.hs:tcRnExports:

If this is a main module without an explicit module header:

  1. Remove special check for GHCi.
  2. If the module has a main function: create a module header to export this main function. This has the effect to mark the main and all top level functions called via main as used .
  3. Otherwise export all functions. This marks all top level functions as used.

This MR replaces MR 215

Merge request reports