Skip to content

-main-is flag should change exports in default module header

The -main-is option to GHC should probably change the export list for the default module header. It doesn't.

$ cat Main.hs
program = return ()
$ ghc -main-is Main.program Main.hs 
[1 of 1] Compiling Main             ( Main.hs, Main.o )

Main.hs:1:1: error:
    Not in scope: ‘main’
    Perhaps you meant ‘min’ (imported from Prelude)

Main.hs:1:1: error:
    The main IO action ‘program’ is not exported by module ‘Main’

I cannot imagine any possible use case for a feature that changes the entry point name to something else, and then deliberately fails to export the symbol by that name. This seems like an obvious thing to fix.

Trac metadata
Trac field Value
Version 8.0.1
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information