Skip to content

GHC does not eforce that Main exports main

The Haskell 98 report says "A Haskell program is a 
collection of
modules, one of which, by convention, must be called 
Main and must
export the value main." However, the program below 
builds and executes
fine.

module Main() -- should be "module Main" or "module 
Main(main)"
where
main = putStrLn "Hello, World"

$ runghc Main.hs
Hello, World

Originally reported by Brian Smith 
[brianlsmith@gmail.com]
Edited by Simon Marlow
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information