import SrcLoc ( SrcLoc, noSrcLoc )
import Util ( sortLt )
import Outputable
+import CmdLineOpts ( DynFlags )
import System ( ExitCode(..), exitWith )
import IO ( hPutStr, stderr )
| 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)
\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,