{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Ouroboros.Consensus.Util.CallStack (
prettyCallStack
, PrettyCallStack
, HasCallStack
) where
import GHC.Stack (CallStack, HasCallStack)
import qualified GHC.Stack as GHC
import NoThunks.Class (NoThunks)
newtype PrettyCallStack = PrettyCallStack CallStack
deriving (Context -> PrettyCallStack -> IO (Maybe ThunkInfo)
Proxy PrettyCallStack -> String
(Context -> PrettyCallStack -> IO (Maybe ThunkInfo))
-> (Context -> PrettyCallStack -> IO (Maybe ThunkInfo))
-> (Proxy PrettyCallStack -> String)
-> NoThunks PrettyCallStack
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy PrettyCallStack -> String
$cshowTypeOf :: Proxy PrettyCallStack -> String
wNoThunks :: Context -> PrettyCallStack -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> PrettyCallStack -> IO (Maybe ThunkInfo)
noThunks :: Context -> PrettyCallStack -> IO (Maybe ThunkInfo)
$cnoThunks :: Context -> PrettyCallStack -> IO (Maybe ThunkInfo)
NoThunks)
instance Show PrettyCallStack where
show :: PrettyCallStack -> String
show (PrettyCallStack CallStack
cs) = CallStack -> String
GHC.prettyCallStack CallStack
cs
prettyCallStack :: HasCallStack => PrettyCallStack
prettyCallStack :: PrettyCallStack
prettyCallStack = CallStack -> PrettyCallStack
PrettyCallStack CallStack
HasCallStack => CallStack
GHC.callStack