From 4465c6cb4d5b0a90337916643defb3cf0c506515 Mon Sep 17 00:00:00 2001 From: simonpj Date: Mon, 21 Dec 1998 10:45:36 +0000 Subject: [PATCH] [project @ 1998-12-21 10:45:36 by simonpj] Add utils/Panic.lhs --- ghc/compiler/utils/Panic.lhs | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 ghc/compiler/utils/Panic.lhs diff --git a/ghc/compiler/utils/Panic.lhs b/ghc/compiler/utils/Panic.lhs new file mode 100644 index 0000000..c3e4865 --- /dev/null +++ b/ghc/compiler/utils/Panic.lhs @@ -0,0 +1,35 @@ +% +% (c) The GRASP Project, Glasgow University, 1992-1998 +% +\section{Panic error messages} + +Defines basic funtions for printing error messages. + +It's hard to put these functions anywhere else without causing +some unnecessary loops in the module dependency graph. + +\begin{code} +module Panic ( panic, panic#, assertPanic, trace ) where + +import GlaExts( trace ) + +#include "HsVersions.h" +\end{code} + +\begin{code} +panic :: String -> a +panic x = error ("panic! (the `impossible' happened):\n\t" + ++ x ++ "\n\n" + ++ "Please report it as a compiler bug " + ++ "to glasgow-haskell-bugs@dcs.gla.ac.uk.\n\n" ) + +-- #-versions because panic can't return an unboxed int, and that's +-- what TAG_ is with GHC at the moment. Ugh. (Simon) +-- No, man -- Too Beautiful! (Will) + +panic# :: String -> FAST_INT +panic# s = case (panic s) of () -> ILIT(0) + +assertPanic :: String -> Int -> a +assertPanic file line = panic ("ASSERT failed! file " ++ file ++ ", line " ++ show line) +\end{code} -- 1.7.10.4