blob: 9a23062f5a6e54cdf1018f1a80f25aba16670188 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
{-# OPTIONS_GHC -O2 -fforce-recomp #-}
module T18086 where
import GHC.Stack
import GHC.Utils.Panic.Plain
import Control.Exception
import System.IO.Unsafe
-- Should have strictness signature <L>x, emphasis on the exceptional
-- divergence result.
m :: IO ()
m = do
putStrLn "foo"
error "bar"
-- Ditto, just in a more complex scenario (the original reproducer of #18086)
panic :: String -> a
panic x = unsafeDupablePerformIO $ do
stack <- ccsToStrings =<< getCurrentCCS x
if null stack
then throw (PlainPanic x)
else throw (PlainPanic (x ++ '\n' : renderStack stack))
|