Commit 4c5dd279 authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Redefine pprPanicFastInt in terms of panicDoc

parent 0fdca5de
......@@ -931,10 +931,7 @@ pprDefiniteTrace str doc x = pprDebugAndThen trace str doc x
pprPanicFastInt :: String -> SDoc -> FastInt
-- ^ Specialization of pprPanic that can be safely used with 'FastInt'
pprPanicFastInt heading pretty_msg =
panicFastInt (show (runSDoc doc (initSDocContext PprDebug)))
where
doc = text heading <+> pretty_msg
pprPanicFastInt heading pretty_msg = panicDocFastInt heading pretty_msg
warnPprTrace :: Bool -> String -> Int -> SDoc -> a -> a
-- ^ Just warn about an assertion failure, recording the given file and line number.
......
......@@ -14,7 +14,7 @@ module Panic (
pgmError,
panic, sorry, panicFastInt, assertPanic, trace,
panicDoc, sorryDoc, pgmErrorDoc,
panicDoc, sorryDoc, panicDocFastInt, pgmErrorDoc,
Exception.Exception(..), showException, safeShowException, try, tryMost, throwTo,
......@@ -213,6 +213,9 @@ pgmErrorDoc x doc = throwGhcException (PprProgramError x doc)
panicFastInt :: String -> FastInt
panicFastInt s = case (panic s) of () -> _ILIT(0)
panicDocFastInt :: String -> SDoc -> FastInt
panicDocFastInt s d = case (panicDoc s d) of () -> _ILIT(0)
-- | Throw an failed assertion exception for a given filename and line number.
assertPanic :: String -> Int -> a
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment