+
+checkMainExported :: TcGblEnv -> TcM ()
+checkMainExported tcg_env = do
+ dflags <- getDOpts
+ case tcg_main tcg_env of
+ Nothing -> return () -- not the main module
+ Just main_name -> do
+ let main_mod = mainModIs dflags
+ checkTc (main_name `elem` concatMap availNames (tcg_exports tcg_env)) $
+ ptext (sLit "The") <+> ppMainFn (nameRdrName main_name) <+>
+ ptext (sLit "is not exported by module") <+> quotes (ppr main_mod)