[Hackage] #179: support GHC's main-is extension

Hackage cvs-ghc at haskell.org
Mon Mar 7 00:02:46 CET 2011


#179: support GHC's main-is extension
----------------------------+-----------------------------------------------
  Reporter:  duncan         |        Owner:         
      Type:  enhancement    |       Status:  new    
  Priority:  low            |    Milestone:  _|_    
 Component:  Cabal library  |      Version:  1.2.2.0
  Severity:  normal         |     Keywords:         
Difficulty:  normal         |   Ghcversion:  6.4.2  
  Platform:  Linux          |  
----------------------------+-----------------------------------------------

Comment(by mcandre):

 -main-is doesn't seem to play nice with multiple Haskell files.

 {{{
 $ 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.main test.hs scriptedmain.hs
 compilation IS NOT required
 ld: duplicate symbol _ZCMain_main_info in scriptedmain.o and test.o
 collect2: ld returned 1 exit status
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/hackage/ticket/179#comment:9>
Hackage <http://haskell.org/cabal/>
Hackage: Cabal and related projects



More information about the cabal-devel mailing list