[Hackage] #179: support GHC's main-is extension
Hackage
trac at galois.com
Thu Nov 15 13:07:32 EST 2007
#179: support GHC's main-is extension
--------------------------+-------------------------------------------------
Reporter: duncan | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone:
Component: Cabal | Version: 1.2.2.0
Severity: normal | Keywords:
Difficulty: normal | Ghcversion: 6.4.2
Platform: Linux |
--------------------------+-------------------------------------------------
Query on haskell-cafe: http://haskell.org/pipermail/haskell-
cafe/2007-November/034686.html
{{{
It seems the meaning of the -main-is switch for GHC and the Main-Is
build option for Cabal executables differ. With GHC, I can point to
any function "main" in any module, but in Cabal I must point to a
filename with precisely the module name "Main". This is tying my hands
with regard to organizing a default executable and exposing some of
its functionality as a library. Is there a way to get around this
restriction?
Concretely, I want to point Cabal's Main-Is to Program/Main.hs
which starts with
module Program.Main where
instead of just
module Main where
}}}
So in GHC it has this meaning:
http://haskell.org/ghc/docs/latest/html/users_guide/options-phases.html
#options-linker
{{{
-main-is thing
The normal rule in Haskell is that your program must supply a
main function in module Main. When testing, it is often
convenient to change which function is the "main" one, and
the -main-is flag allows you to do so. The thing can be one of:
A lower-case identifier foo. GHC assumes that the main
function is Main.foo.
An module name A. GHC assumes that the main function
is A.main.
An qualified name A.foo. GHC assumes that the main
function is A.foo.
}}}
In Cabal the {{{main-is:}}} field specifies the '''file name''' of the
Main module.
GHC's {{{-main-is}}} flag is an extension to Haskell that is not supported
by the other Haskell implementations.
--
Ticket URL: <http://hackage.haskell.org/trac/hackage/ticket/179>
Hackage <http://haskell.org/cabal/>
Hackage: Cabal and related projects
More information about the cabal-devel
mailing list