Closed dyniec closed 1 year ago
Thanks for the request! This has been on my mind too.
haskell-src-exts
is also kind of awkward since I'd like users to be able to use all the extensions.Main
when the user wants to Run, and give back the error that GHC will print (The IO action ‘main’ is not defined in module ‘Main’
)?Oh, now I see what you mean! GHC already does the right thing if you just don't tell it to -o Main
. :)
You were entirely correct. With that tiny change, what you want just works, with the only snag that you do need to write module Something where
if your file doesn't have a main
.
GHC already does the right thing if you just don't tell it to -o Main. :)
Good to hear that! Thanks for fast response and implementation :)
Feature request
Right now to inspect core/asm output you need to write empty main function. If you want to inspect specific function, you need to either export it, or call it in main, and hope simplifier doesn't inline it completely(unless that's what you are hoping for).
It would be nice to allow compilation of modules that are not Main, since that would remove the need to write empty main function. This together with snippet
module M where
would make it easy to see core/asm dump of all top-level definitions.Workaround for now is to specify
module Main
module on top, export selected (or all) functions, and write emptymain
(see here Working version vs no main or no exports).As for implementation, removal of
-o Main
flag from stage-3.sh could be enough to make it work (I don't have ghc on hand right now to check if that would really work).