| otherwise =
( noSrcLoc, hang (text title <> colon) 4 rest_of_err_msg )
-printErrorsAndWarnings :: Bag ErrMsg -> Bag WarnMsg -> IO ()
+printErrorsAndWarnings :: (Bag WarnMsg, Bag ErrMsg) -> IO ()
-- Don't print any warnings if there are errors
-printErrorsAndWarnings errs warns
+printErrorsAndWarnings (warns, errs)
| no_errs && no_warns = return ()
| no_errs = printErrs (pprBagOfWarnings warns)
| otherwise = printErrs (pprBagOfErrors errs)
renameModule pcs this_mod@(HsModule mod_name vers exports imports local_decls _ loc)
= -- Initialise the renamer monad
do {
- ((maybe_rn_stuff, dump_action), rn_errs_bag, rn_warns_bag)
+ ((maybe_rn_stuff, dump_action), msgs)
<- initRn pcs
(mkThisModule mod_name)
(mkSearchPath opt_HiMap) loc
(rename this_mod) ;
-- Check for warnings
- printErrorsAndWarnings rn_errs_bag rn_warns_bag ;
+ printErrorsAndWarnings msgs ;
-- Dump any debugging output
dump_action ;
-> PersistentRenamerState
-> Module -> SrcLoc
-> RnMG t
- -> IO (t, Bag WarnMsg, Bag ErrMsg)
+ -> IO (t, (Bag WarnMsg, Bag ErrMsg))
initRn dflags finder gst prs mod loc do_rn
= do uniqs <- mkSplitUniqSupply 'r'
-- grab errors and return
(warns, errs) <- readIORef errs_var
- return (res, errs, warns)
+ return (res, (warns, errs))
initIfaces :: PersistentRenamerState -> Ifaces
typecheckModule pcs hst (HsModule mod_name _ _ _ decls _ src_loc)
= do { env <- initTcEnv global_symbol_table global_inst_env ;
- (_, (maybe_result, warns, errs)) <- initTc env src_loc tc_module
+ (_, (maybe_result, msgs)) <- initTc env src_loc tc_module
- printErrorsAndWarnings errs warns ;
+ printErrorsAndWarnings msgs ;
printTcDumps maybe_result ;
initTc :: TcEnv
-> SrcLoc
-> TcM r
- -> IO (Maybe r, Bag WarnMsg, Bag ErrMsg)
+ -> IO (Maybe r, (Bag ErrMsg, Bag WarnMsg))
initTc tc_env src_loc do_this
= do {
(\_ -> return Nothing) ;
(warns,errs) <- readIORef errs_var ;
- return (maybe_res, warns, errs)
+ return (maybe_res, (warns, errs))
}
-- Monadic operations