--- | Rename and typecheck a module, additinoally returning the renamed syntax
-typecheckRenameModule :: HscEnv -> ModSummary -> Located (HsModule RdrName)
- -> IO (Maybe (TcGblEnv, RenamedStuff))
-typecheckRenameModule hsc_env mod_summary rdr_module
- = do
- (tc_msgs, maybe_tc_result)
- <- {-# SCC "Typecheck-Rename" #-}
- tcRnModule hsc_env (ms_hsc_src mod_summary) True rdr_module
- printErrorsAndWarnings dflags tc_msgs
- case maybe_tc_result of
- Nothing -> return Nothing
- Just tc_result -> do
- let rn_info = do decl <- tcg_rn_decls tc_result
- imports <- tcg_rn_imports tc_result
- let exports = tcg_rn_exports tc_result
- let doc = tcg_doc tc_result
- let hmi = tcg_hmi tc_result
- return (decl,imports,exports,doc,hmi)
- return (Just (tc_result, rn_info))
- where
- dflags = hsc_dflags hsc_env
+-- | Rename and typecheck a module, additionally returning the renamed syntax
+typecheckRenameModule
+ :: GhcMonad m =>
+ HscEnv -> ModSummary -> Located (HsModule RdrName)
+ -> m (TcGblEnv, RenamedStuff)
+typecheckRenameModule hsc_env mod_summary rdr_module = do
+ tc_result
+ <- {-# SCC "Typecheck-Rename" #-}
+ ioMsgMaybe $ tcRnModule hsc_env (ms_hsc_src mod_summary) True rdr_module
+
+ let rn_info = do decl <- tcg_rn_decls tc_result
+ imports <- tcg_rn_imports tc_result
+ let exports = tcg_rn_exports tc_result
+ let doc = tcg_doc tc_result
+ let hmi = tcg_hmi tc_result
+ return (decl,imports,exports,doc,hmi)
+
+ return (tc_result, rn_info)