Is there some way (flag or hack) to make GHC accept a main module where the main function's signature isn't IO ()? For Fay the main functions have the type Fay (), but GHC does not accept this if the module is Main (or the module name is left out).
The entry point to the programme must have type IO a for some a, and as far as I know, there is no way to make GHC accept other types (without modifying its source code).
By default the entry point is Main.main, but you can specify different actions as entry points using the -main-is flag with GHC. The general form is
ghc -main-is Module.action ModuleThatImportsEverything.hs -o programme
You can omit the Module part if the module is Main,
ghc -main-is action ModuleThatImportsEverything.hs -o programme
or the actionpart, if its name is main,
ghc -main-is Module ModuleThatImportsEverything.hs -o programme
is equivalent to -main-is Module.main.
For your case, you can add a dummy action to the Main module, or a dummy module - that of course needs to be imported (directly or indirectly) from the Main module - to the programme to stand in as the entry point as far as GHC is concerned.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With