Skip to content

-main-is should be a link time option, not compile time

The -main-is flag specifies which function name to use as main. However, when doing separate compilation:

ghc -c Foo.hs
ghc Foo.o

You have to give the -main-is in the first step - the compilation, rather than in the second step, the linking. It feels like this flag should be a link time option, and would give greater flexibility allowing one object file to be used in multiple projects with different main commands.

If you compile with ghc --make this issue isn't really a problem.

Trac metadata
Trac field Value
Version 6.10.1
Type Bug
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