not naming modules Main

Simon Peyton-Jones simonpj@microsoft.com
Mon, 19 Nov 2001 01:07:23 -0800


(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". =20

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]=20
| Sent: 16 November 2001 18:34
| To: haskell@haskell.org
| Subject: not naming modules Main
|=20
|=20
| I'm really frustrated that modules that you want to compile=20
| to executables have to be named Main.  I often have a module=20
| with a main method that I use for testing or whatever=20
| (perhaps I want the gained speed of an executable) but is,=20
| for the most part, a module I import into others.  I end up=20
| having to constantly change the module name whenever I want=20
| to compile it and I find this terribly frustrating.
|=20
| Is there any reason you can't just compile things that simply=20
| export a main method with the proper type?  Is this a ghc=20
| specific thing or does nhc also have this restriction?  Any=20
| chance ghc will change its policy on this?
|=20
|  - Hal
|=20
| --=20
| Hal Daume III
|=20
|  "Computer science is no more about computers    | hdaume@isi.edu
|   than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume
|=20
| _______________________________________________
| Haskell mailing list
| Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
|=20
|=20