X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Frename%2FRnNames.lhs;h=58dd7a6e76e946df7165289708362833670de14b;hb=f83ad713ad73e583fd138bb17e7341041b36a416;hp=881f497b81eaae71658cca4649feefdee5758df2;hpb=94ff1ec1546169fc839b2318c0d141f3089d3e26;p=ghc-hetmet.git diff --git a/ghc/compiler/rename/RnNames.lhs b/ghc/compiler/rename/RnNames.lhs index 881f497..58dd7a6 100644 --- a/ghc/compiler/rename/RnNames.lhs +++ b/ghc/compiler/rename/RnNames.lhs @@ -31,6 +31,7 @@ import RnMonad import FiniteMap import PrelMods +import PrelInfo ( main_RDR ) import UniqFM ( lookupUFM ) import Bag ( bagToList ) import Maybes ( maybeToBool ) @@ -255,10 +256,10 @@ importsFromLocalDecls mod rec_exp_fn decls non_singleton other = False in -- Check for duplicate definitions - mapRn (addErrRn . dupDeclErr) dups `thenRn_` + mapRn_ (addErrRn . dupDeclErr) dups `thenRn_` -- Record that locally-defined things are available - mapRn (recordSlurp Nothing Compulsory) avails `thenRn_` + mapRn_ (recordSlurp Nothing Compulsory) avails `thenRn_` -- Build the environment qualifyImports mod @@ -308,10 +309,10 @@ fixitiesFromLocalDecls gbl_env decls getFixities acc (FixD fix) = fix_decl acc fix + getFixities acc (TyClD (ClassDecl _ _ _ sigs _ _ _ _ _)) = foldlRn fix_decl acc [sig | FixSig sig <- sigs] - -- Get fixities from class decl sigs too - + -- Get fixities from class decl sigs too. getFixities acc other_decl = returnRn acc @@ -523,8 +524,13 @@ exportsFromAvail :: Module -- Warns about identical exports. -- Complains about exports items not in scope exportsFromAvail this_mod Nothing export_avails global_name_env - = exportsFromAvail this_mod (Just [IEModuleContents this_mod]) - export_avails global_name_env + = exportsFromAvail this_mod true_exports export_avails global_name_env + where + true_exports = Just $ if this_mod == mAIN + then [IEVar main_RDR] + -- export Main.main *only* unless otherwise specified, + else [IEModuleContents this_mod] + -- but for all other modules export everything. exportsFromAvail this_mod (Just export_items) (mod_avail_env, entity_avail_env)