not naming modules Main

John Meacham john@repetae.net
Tue, 20 Nov 2001 12:07:57 -0800


what I would like is not a --main-in option but a --main-is one which
takes a qualified haskell name (defaulting to Main.main) which must be
of type IO a and is used as the entry point. note that I have found such
funcionality quite useful when linking other languages, it would be
really nice if it were in haskell as well. (I don't think --main-is is
the best syntax though, but you get the idea.)
	John

On Mon, Nov 19, 2001 at 01:07:23AM -0800, Simon Peyton-Jones wrote:
> (Moving this to GHC users.)
> 
> What exactly do you propose?
> 
> * Haskell allows you to define a 'main' in any module you please.
> 
> * GHCi allows you to execute any of these 'main' functions
> independently.
>   (You get all the speed of compiled code if you compile the module
>   first and load the compiled module into GHCi.)
> 
> * But if you want to link together a bunch of modules into an
> executable,
>   there must be some way to decide which 'main' you want to execute.
>   Haskell's way is to say "It's the 'main' from module Main".  
> 
> We like feedback about what would be useful -- GHC has lots of things
> that aren't exactly Haskell that were generated by such suggestions.
> But I'm unclear what you would like (let alone how easy it would
> be to implement).
> 
> Simon
> 
> | -----Original Message-----
> | From: Hal Daume [mailto:hdaume@ISI.EDU] 
> | Sent: 16 November 2001 18:34
> | To: haskell@haskell.org
> | Subject: not naming modules Main
> | 
> | 
> | I'm really frustrated that modules that you want to compile 
> | to executables have to be named Main.  I often have a module 
> | with a main method that I use for testing or whatever 
> | (perhaps I want the gained speed of an executable) but is, 
> | for the most part, a module I import into others.  I end up 
> | having to constantly change the module name whenever I want 
> | to compile it and I find this terribly frustrating.
> | 
> | Is there any reason you can't just compile things that simply 
> | export a main method with the proper type?  Is this a ghc 
> | specific thing or does nhc also have this restriction?  Any 
> | chance ghc will change its policy on this?
> | 
> |  - Hal
> | 
> | -- 
> | Hal Daume III
> | 
> |  "Computer science is no more about computers    | hdaume@isi.edu
> |   than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume
> | 
> | _______________________________________________
> | Haskell mailing list
> | Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
> | 
> | 
> 
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users@haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
> 

-- 
---------------------------------------------------------------------------
John Meacham - California Institute of Technology, Alum. - john@repetae.net
---------------------------------------------------------------------------