
Duncan Coutts wrote:
On Tue, 2008-05-06 at 09:43 -0400, Mario Blazevic wrote:
Trevor Elliott wrote:
Cabal doesn't pass the --main-is option, I believe because it is specific to GHC. What you could do is add this flag in the ghc-options field of your executable in the cabal file, like this:
ghc-options: --main-is Shell That worked like charm, except the two dashes should be one (my mistake). Thank you.
Note that hackage will reject packages that use "ghc-options: -main-is" with the message that it is not portable. The rationale is that unlike other non-portable extensions, it is easy to change to make it portable: http://hackage.haskell.org/trac/hackage/ticket/179 If you want to argue for supporting this ghc extension and/or implement support (possibly with workaround support for the other haskell implementations) then please do comment on the above ticket.
Duncan
After some experimentation, I've changed my opinion and now agree with the current behaviour. I had the impression that every Haskell module had to reside in a same-named file. While this appears to be true for *imported* modules and GHC (hence my mistaken impression), the Haskell 98 standard does not specify anything of the sort. In case of the top-level module, GHC (as well as the standard) allows it to reside in a file of any name. So the only reasonable use for -main-is option, as I see it, is to allow multiple small main modules residing in the same file, and I guess that's not likely to be encountered in a package.