[project @ 2000-10-16 08:24:18 by simonpj]
[ghc-hetmet.git] / ghc / compiler / main / ErrUtils.lhs
index db0c997..18b9e38 100644 (file)
@@ -20,6 +20,7 @@ import Bag            ( Bag, bagToList, isEmptyBag )
 import SrcLoc          ( SrcLoc, noSrcLoc )
 import Util            ( sortLt )
 import Outputable
+import CmdLineOpts     ( DynFlags )
 
 import System          ( ExitCode(..), exitWith )
 import IO              ( hPutStr, stderr )
@@ -60,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)
@@ -98,10 +99,10 @@ doIfSet flag action | flag      = action
 \end{code}
 
 \begin{code}
-dumpIfSet :: Bool -> String -> SDoc -> IO ()
-dumpIfSet flag hdr doc
-  | not flag  = return ()
-  | otherwise = printDump dump
+dumpIfSet :: DynFlags -> (DynFlags -> Bool) -> String -> SDoc -> IO ()
+dumpIfSet dflags flag hdr doc
+  | not (flag dflags)  = return ()
+  | otherwise          = printDump dump
   where
     dump = vcat [text "", 
                 line <+> text hdr <+> line,