From e7a80ef9f4ba0e2e6edeed04a0acc6e93cb9f91c Mon Sep 17 00:00:00 2001 From: sof Date: Wed, 24 Mar 1999 18:19:08 +0000 Subject: [PATCH] [project @ 1999-03-24 18:19:08 by sof] tidied up the error handling defs. --- ghc/compiler/utils/Outputable.lhs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/ghc/compiler/utils/Outputable.lhs b/ghc/compiler/utils/Outputable.lhs index bd33b86..1ddb112 100644 --- a/ghc/compiler/utils/Outputable.lhs +++ b/ghc/compiler/utils/Outputable.lhs @@ -340,8 +340,6 @@ pprQuotedList xs = hsep (punctuate comma (map (quotes . ppr) xs)) \end{code} - - %************************************************************************ %* * \subsection{Printing numbers verbally} @@ -386,22 +384,21 @@ speakNTimes t | t == 1 = ptext SLIT("once") \begin{code} pprPanic :: String -> SDoc -> a -pprPanic heading pretty_msg = panic (show (doc PprDebug)) - where - doc = text heading <+> pretty_msg - pprError :: String -> SDoc -> a -pprError heading pretty_msg = error (heading++ " " ++ (showSDoc pretty_msg)) - pprTrace :: String -> SDoc -> a -> a -pprTrace heading pretty_msg = trace (show (doc PprDebug)) - where - doc = text heading <+> pretty_msg +pprPanic = pprAndThen panic +pprError = pprAndThen error +pprTrace = pprAndThen trace pprPanic# heading pretty_msg = panic# (show (doc PprDebug)) where doc = text heading <+> pretty_msg +pprAndThen :: (String -> a) -> String -> SDoc -> a +pprAndThen cont heading pretty_msg = cont (show (doc PprDebug)) + where + doc = text heading <+> pretty_msg + assertPprPanic :: String -> Int -> SDoc -> a assertPprPanic file line msg = panic (show (doc PprDebug)) -- 1.7.10.4