printErrorsAndWarnings, pprBagOfErrors, pprBagOfWarnings,
+ printError,
ghcExit,
- doIfSet, doIfSet_dyn, dumpIfSet, dumpIfSet_core, dumpIfSet_dyn, showPass
+ doIfSet, doIfSet_dyn,
+ dumpIfSet, dumpIfSet_core, dumpIfSet_dyn, dumpIfSet_dyn_or,
+ showPass
) where
#include "HsVersions.h"
import Outputable
import CmdLineOpts ( DynFlags(..), DynFlag(..), dopt )
+import List ( replicate )
import System ( ExitCode(..), exitWith )
-import IO ( hPutStr, stderr )
+import IO ( hPutStr, hPutStrLn, stderr )
\end{code}
\begin{code}
\end{code}
+\begin{code}
+printError :: String -> IO ()
+printError str = hPutStrLn stderr str
+\end{code}
\begin{code}
type Messages = (Bag WarnMsg, Bag ErrMsg)
| dopt flag dflags || verbosity dflags >= 4 = printDump (dump hdr doc)
| otherwise = return ()
+dumpIfSet_dyn_or :: DynFlags -> [DynFlag] -> String -> SDoc -> IO ()
+dumpIfSet_dyn_or dflags flags hdr doc
+ | or [dopt flag dflags | flag <- flags]
+ || verbosity dflags >= 4
+ = printDump (dump hdr doc)
+ | otherwise = return ()
+
dump hdr doc
= vcat [text "",
line <+> text hdr <+> line,
doc,
text ""]
where
- line = text (take 20 (repeat '='))
+ line = text (replicate 20 '=')
\end{code}