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

Hackage cvs-ghc at haskell.org
Wed Mar 23 08:46:16 CET 2011

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

Comment(by Evi1M4chine):

 Hey, I just noticed the same problem, and I think it’s weird to force the
 main function to be “main” in the module “Main”. First of all, because
 most people in the world don’t prefer English as it isn’t their native
 language, and secondly because the main module, main function and main
 file name should 1. be the same and 2. be the name of your project.

 I have a program called “Ozon”, which has to build targets:
 Programm: ghc -threaded -static -O2 -fPIC -Wall -Wwarn -outputdir bauen
 -fglasgow-exts -iquellen -main-is Ozon.ozon -o ozon --make quellen/Ozon.hs
 Test: ghc -threaded -static -debug -O0 -fPIC -Wall -Wwarn -outputdir bauen
 -fglasgow-exts -iquellen -main-is Ozon.teste -o teste --make

 As you can see, the main module (Ozon) in the main file (Ozon.hs) has
 *two* main functions. One for each mode/target.

 With Cabal, it’s not possible do do this, and you’re forced to make a mess
 out of it, by inconsistently naming things and splitting up files that
 shouldn’t be split up.

 Even enforcing “-main-is" in “ghc-options:” is not working with two build
 targets. (Unless leksah generates the cabal file wrongly, but I
 don’t think so.) The second one is simply ignored, and both resulting
 binaries are exactly the same.

 It would be enough, if those ghc-options would work properly. But of
 course, main-is should be renamed main-file-is, and a main-function-is
 should be added. (The main module name can be automatically deduced from
 the “module” statement in the main file.)

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

More information about the cabal-devel mailing list