-
Simon Peyton Jones authored
--------- Main.main --------- A bunch of related fixes concerning 'main' * Arrange that 'main' doesn't need to be defined in module Main; it can be imported. * The typechecker now injects a binding Main.$main = PrelTopHandler.runMain main So the runtime system now calls Main.$main, not PrelMain.main. With z-encoding, this look like Main_zdmain_closure * The function PrelTopHandler.runMain :: IO a -> IO () wraps the programmer's 'main' in an exception-cacthing wrapper. * PrelMain.hs and Main.hi-boot are both removed from lib/std, along with multiple lines of special case handling in lib/std/Makefile. This is a worthwhile cleanup. * Since we now pick up whatever 'main' is in scope, the ranamer gets in on the act (RnRnv.checkMain). There is a little more info to get from the renamer to the typechecker, so I've defined a new type Rename.RnResult (c.f. TcModule.TcResult) * With GHCi, it's now a warning, not an error, to omit the binding of main (RnEnv.checkMain) * It would be easy to add a flag "-main-is foo"; the place to use that information is in RnEnv.checkMain. ------- On the way I made a new type, type HscTypes.FixityEnv = NameEnv Fixity and used it in various places I'd tripped over
e6601808