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 )
\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
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)
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 ->
-- 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)
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 $
= 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}