[Haskell-beginners] GHC compilation without using module Main

Andrew Pennebaker andrew.pennebaker at gmail.com
Sun Mar 6 23:32:43 CET 2011


Is there a way to compile a Haskell script with a different module name than
Main?

#!/usr/bin/env runhaskell

module ScriptedMain where

meaningOfLife :: Int
meaningOfLife = 42

main :: IO ()
main = putStrLn $ "Main: The meaning of life is " ++ show meaningOfLife

$ ghc -o scriptedmain scriptedmain.hs
Undefined symbols:
  "_ZCMain_main_closure", referenced from:
      _ZCMain_main_closure$non_lazy_ptr in libHSrtsmain.a(Main.o)
     (maybe you meant: _ZCMain_main_closure$non_lazy_ptr)
  "___stginit_ZCMain", referenced from:
      ___stginit_ZCMain$non_lazy_ptr in libHSrtsmain.a(Main.o)
     (maybe you meant: ___stginit_ZCMain$non_lazy_ptr)
ld: symbol(s) not found
collect2: ld returned 1 exit status

Cheers,

Andrew Pennebaker
www.yellosoft.us
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110306/acdcc37a/attachment.htm>


More information about the Beginners mailing list