import System ( ExitCode(..), exitWith )
import DATA_IOREF
import IO ( hPutStrLn, stderr )
+import DYNAMIC
-- -----------------------------------------------------------------------------
-- NB Pretty.Doc not SDoc: we deal with the printing style (in ptic
-- whether to qualify an External Name) at the error occurrence
+-- So we can throw these things as exceptions
+errMsgTc :: TyCon
+errMsgTc = mkTyCon "ErrMsg"
+{-# NOINLINE errMsgTc #-}
+instance Typeable ErrMsg where
+#if __GLASGOW_HASKELL__ < 603
+ typeOf _ = mkAppTy errMsgTc []
+#else
+ typeOf _ = mkTyConApp errMsgTc []
+#endif
+
type WarnMsg = ErrMsg
-- A short (one-line) error message, with context to tell us whether
compilationPassMsg dflags msg
= ifVerbose dflags 2 (putMsg msg)
-debugTraceMsg :: DynFlags -> String -> IO ()
-debugTraceMsg dflags msg
- = ifVerbose dflags 2 (putMsg msg)
+debugTraceMsg :: DynFlags -> Int -> String -> IO ()
+debugTraceMsg dflags val msg
+ = ifVerbose dflags val (putMsg msg)
GLOBAL_VAR(msgHandler, hPutStrLn stderr, (String -> IO ()))