not naming modules Main

Simon Peyton-Jones
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
  (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
  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).


| -----Original Message-----
| From: Hal Daume [mailto:hdaume@ISI.EDU]=20
| Sent: 16 November 2001 18:34
| To:
| Subject: not naming modules Main
| 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.
| 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?
|  - Hal
| --=20
| Hal Daume III
|  "Computer science is no more about computers    |
|   than astronomy is about telescopes." -Dijkstra |
| _______________________________________________
| Haskell mailing list