[project @ 1996-04-25 13:02:32 by partain]
[ghc-hetmet.git] / ghc / compiler / typecheck / TcModule.lhs
index 39122d3..9f2df4d 100644 (file)
@@ -39,12 +39,12 @@ import Bag          ( listToBag )
 import Class           ( GenClass )
 import Id              ( GenId, isDataCon, isMethodSelId, idType )
 import Maybes          ( catMaybes )
-import Outputable      ( isExported, isLocallyDefined )
+import Name            ( isExported, isLocallyDefined )
 import PrelInfo                ( unitTy, mkPrimIoTy )
 import Pretty
-import RnUtils         ( GlobalNameMappers(..), GlobalNameMapper(..) )
+import RnUtils         ( RnEnv(..) )
 import TyCon           ( TyCon )
-import Type            ( applyTyCon )
+import Type            ( mkSynTy )
 import Unify           ( unifyTauTy )
 import UniqFM          ( lookupUFM_Directly, lookupWithDefaultUFM_Directly,
                          filterUFM, eltsUFM )
@@ -59,7 +59,7 @@ tycon_specs = emptyFM
 \end{code}
 
 \begin{code}
-tcModule :: GlobalNameMappers          -- final renamer info for derivings
+tcModule :: RnEnv                      -- for renaming derivings
         -> RenamedHsModule             -- input
         -> TcM s ((TypecheckedHsBinds, -- record selector binds
                    TypecheckedHsBinds, -- binds from class decls; does NOT
@@ -81,7 +81,7 @@ tcModule :: GlobalNameMappers         -- final renamer info for derivings
 
                   PprStyle -> Pretty)  -- -ddump-deriving info
 
-tcModule renamer_name_funs
+tcModule rn_env
        (HsModule mod_name verion exports imports fixities
                  ty_decls specdata_sigs cls_decls inst_decls specinst_sigs
                  default_decls val_decls sigs src_loc)
@@ -103,15 +103,15 @@ tcModule renamer_name_funs
        fixTc ( \ ~(rec_inst_mapper, _, _, _, _, _) ->
 
             -- Type-check the type and class decls
-           trace "tcTyAndClassDecls:"  $
+           --trace "tcTyAndClassDecls:"        $
            tcTyAndClassDecls1 rec_inst_mapper ty_decls_bag cls_decls_bag
                                        `thenTc` \ (env, record_binds) ->
 
                -- Typecheck the instance decls, includes deriving
            tcSetEnv env (
-           trace "tcInstDecls:"        $
+           --trace "tcInstDecls:"      $
            tcInstDecls1 inst_decls_bag specinst_sigs
-                        mod_name renamer_name_funs fixities 
+                        mod_name rn_env fixities 
            )                           `thenTc` \ (inst_info, deriv_binds, ddump_deriv) ->
 
            buildInstanceEnvs inst_info `thenTc` \ inst_mapper ->
@@ -142,7 +142,7 @@ tcModule renamer_name_funs
 
        -- Value declarations next.
        -- We also typecheck any extra binds that came out of the "deriving" process
-    trace "tcBinds:"                   $
+    --trace "tcBinds:"                 $
     tcBindsAndThen
        (\ binds1 (binds2, thing) -> (binds1 `ThenBinds` binds2, thing))
        (val_decls `ThenBinds` deriv_binds)
@@ -233,7 +233,7 @@ checkTopLevelIds mod final_env
        
        case (maybe_main, maybe_prim) of
          (Just main, Nothing) -> tcAddErrCtxt mainCtxt $
-                                 unifyTauTy (applyTyCon io_tc [unitTy])
+                                 unifyTauTy (mkSynTy io_tc [unitTy])
                                             (idType main)
 
          (Nothing, Just prim) -> tcAddErrCtxt primCtxt $
@@ -254,7 +254,5 @@ mainBothIdErr sty
   = ppStr "module Main contains definitions for both main and mainPrimIO"
 
 mainNoneIdErr sty
-  = panic "ToDo: sort out mainIdKey"
- -- ppStr "module Main does not contain a definition for main (or mainPrimIO)"
-
+  = ppStr "module Main does not contain a definition for main (or mainPrimIO)"
 \end{code}