[project @ 2005-05-31 12:45:03 by simonmar]
[ghc-hetmet.git] / ghc / compiler / main / ErrUtils.lhs
index e53e40c..12d3e43 100644 (file)
@@ -39,6 +39,7 @@ import StaticFlags    ( opt_ErrorSpans )
 import System          ( ExitCode(..), exitWith )
 import DATA_IOREF
 import IO              ( hPutStrLn, stderr )
+import DYNAMIC         ( TyCon, mkTyCon, Typeable(..), mkTyConApp )
 
 
 -- -----------------------------------------------------------------------------
@@ -71,6 +72,12 @@ data ErrMsg = ErrMsg {
        -- 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"
+instance Typeable ErrMsg where
+  typeOf _ = mkTyConApp errMsgTc []
+
 type WarnMsg = ErrMsg
 
 -- A short (one-line) error message, with context to tell us whether