Haskell 98 specification says that the entry point of a program, namely, function main
, should reside in the module called Main, by convention. However, even if you don't write module Main where
at the top of the file you write main
in, the source code compiles and seems working correct when you're using GHC.
The question is:
- What's the difference between writing
module Main where
and not writing it? - Which one is preferred?