Re: [commit: ghc] master: Fix pprPanic so that it doesn't throw away the SDoc part of the error. (e6ce335)
Erik de Castro Lopo <[email protected]>
| Newsgroups | gmane.comp.lang.haskell.cvs.ghc |
|---|---|
| Organization | Erik Conspiracy Secret Labs |
| Message-ID | <[email protected]> |
Ian Lynagh wrote:
> I've reverted this: the Doc is passed in the PanicDoc constructor, so it
> shouldn't be necessary.
>
> What problem were you trying to solve?
Well, pprPanic is defined as:
pprPanic :: String -> SDoc -> a
-- ^ Throw an exception saying "bug in GHC"
pprPanic = panicDoc
and panicDoc is defined as:
panicDoc :: String -> SDoc -> a
panicDoc x doc = throwGhcException (PprPanic x doc)
when the exception is throw it ends up in showGhcException which drops
the SDoc part of the message on the floor:
PprPanic s _ ->
showGhcException (Panic (s ++ "\n<<details unavailable>>"))
I tried to convert the SDoc to a String in this code, but that resulted
in a circular import. The obvious solution was the one in my patch.
Erik
--
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/