Skip to content

GHC-9.0.1 doesn't find imported main:

Take two files: Dep.hs and bug-main.hs:

module Dep (main) where

main :: IO ()
main = putStrLn "hello"

and

module Main (main) where
import Dep (main)

An idiom I use, where Dep is a module in a library, and bug-main is main-is file just to make it into an executable.

GHC-8.10 (and all previous) are happy with this layout:

% ghc-8.10.3 --make bug-main.hs
[1 of 2] Compiling Dep              ( Dep.hs, Dep.o )
[2 of 2] Compiling Main             ( bug-main.hs, bug-main.o )
Linking bug-main ...

GHC-9.0.1 isn't:

% ghc-9.0.1 --make bug-main.hs 
[1 of 2] Compiling Dep              ( Dep.hs, Dep.o )
[2 of 2] Compiling Main             ( bug-main.hs, bug-main.o )

bug-main.hs:1:1: error:
    The IO action ‘main’ is not defined in module ‘Main’
  |
1 | module Main (main) where
  | ^

EDIT: I tried with a recent build from master, it is also affected by this.

Edited by Oleg Grenrus
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information