[project @ 2000-10-13 16:00:45 by simonpj]
authorsimonpj <unknown>
Fri, 13 Oct 2000 16:00:45 +0000 (16:00 +0000)
committersimonpj <unknown>
Fri, 13 Oct 2000 16:00:45 +0000 (16:00 +0000)
Tidy up errors and warnings

ghc/compiler/main/ErrUtils.lhs
ghc/compiler/rename/Rename.lhs
ghc/compiler/rename/RnMonad.lhs
ghc/compiler/typecheck/TcModule.lhs
ghc/compiler/typecheck/TcMonad.lhs

index d6a64f3..18b9e38 100644 (file)
@@ -61,9 +61,9 @@ dontAddErrLoc title rest_of_err_msg
  | 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)
index 9d340f2..33cbe0c 100644 (file)
@@ -84,14 +84,14 @@ renameModule :: PersistentCompilerState -> RdrNameHsModule -> IO (Maybe RenameRe
 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 ;
index da68104..d322c20 100644 (file)
@@ -297,7 +297,7 @@ initRn :: DynFlags -> Finder -> GlobalSymbolTable
        -> 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'
@@ -322,7 +322,7 @@ initRn dflags finder gst prs mod loc do_rn
        -- grab errors and return
        (warns, errs) <- readIORef errs_var
 
-       return (res, errs, warns)
+       return (res, (warns, errs))
 
 
 initIfaces :: PersistentRenamerState -> Ifaces
index 62da34d..8b72465 100644 (file)
@@ -87,9 +87,9 @@ typecheckModule
 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 ;
                        
index f104fbe..21a8d89 100644 (file)
@@ -126,7 +126,7 @@ type TcRef a = IORef a
 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 {
@@ -147,7 +147,7 @@ initTc tc_env src_loc do_this
                         (\_ -> return Nothing) ;
         
       (warns,errs) <- readIORef errs_var ;
-      return (maybe_res, warns, errs)
+      return (maybe_res, (warns, errs))
     }
 
 -- Monadic operations