Skip to content

-main-is flag in {-# OPTIONS #-} pragma not fully supported

The -main-is flag is dynamic an may therefore be placed inside the {-# OPTIONS #-} pragma. Version 6.8.3 of runghc respects this flag (that is, runghc works as expected), but this cannot be said of ghc.

Example file T.hs

{-# OPTIONS -main-is T.main #-}

module T where

main :: IO ()
main = putStrLn "Hello world"

Example execution

$ ghc --make -o t T.hs
[1 of 1] Compiling T                ( T.hs, T.o )
Warning: output was redirected with -o, but no output will be generated
because there is no Main module.

Additional notes

This bug is related to ticket #1312 (closed), but the difference is that ticket #1312 (closed) only addressed runghc, not ghc.

Trac metadata
Trac field Value
Version 6.8.3
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