GHCi does not honour implicit `module Main (main) where` for re-exported `main`s
Haskell2010 states:
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
.
Consider the following two modules:
-- module Main (main) where
import Main2 (main)
module Main2 (main) where
main :: IO ()
main = return ()
A non-interactive GHC happily compiles ghc --make Main
, however, GHCi fails with
$ ghci Main.hs
GHCi, version 7.10.3: http://www.haskell.org/ghc/ :? for help
unknown option: 'c'
[1 of 2] Compiling Main2 ( Main2.hs, interpreted )
[2 of 2] Compiling Main ( Main.hs, interpreted )
Main.hs:1:1: The IO action ‘main’ is not exported by module ‘Main’
Failed, modules loaded: Main2.
For GHCi we need to uncomment the explicit module Main (main) where
line to make it work.
Trac metadata
Trac field | Value |
---|---|
Version | 7.10.3 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | GHCi |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |