Created
March 6, 2011 23:14
-
-
Save mcandre/857856 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat scriptedmain.hs | |
#!/usr/bin/env runhaskell | |
module ScriptedMain where | |
meaningOfLife :: Int | |
meaningOfLife = 42 | |
main :: IO () | |
main = putStrLn $ "Main: The meaning of life is " ++ show meaningOfLife | |
$ cat test.hs | |
#!/usr/bin/env runhaskell | |
module Test where | |
import ScriptedMain hiding (main) | |
main :: IO () | |
main = putStrLn $ "Test: The meaning of life is " ++ show meaningOfLife | |
$ ghc -o scriptedmain -main-is ScriptedMain scriptedmain.hs | |
$ ./scriptedmain | |
Main: The meaning of life is 42 | |
$ ghc -o test -main-is Test test.hs scriptedmain.hs | |
compilation IS NOT required | |
compilation IS NOT required | |
ld: duplicate symbol _ZCMain_main_info in scriptedmain.o and test.o | |
collect2: ld returned 1 exit status |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment