packages feed

ghc-debug-common-0.8.0.0: src/GHC/Debug/Utils.hs

module GHC.Debug.Utils where

import Data.Binary.Get
import Data.ByteString.Lazy
import GHC.Stack
import qualified Numeric

runGet_ :: HasCallStack => Get a -> ByteString -> a
runGet_ g b = case runGetOrFail g b of
                Left (_, _, err) -> error err
                Right (_, _, r) -> r

showAsHex :: Integral a => a -> String
showAsHex n = "0x" ++ Numeric.showHex n ""