{-# LANGUAGE Trustworthy #-}------------------------------------------------------------------------------- |-- Module : GHC.Stack-- Copyright : (c) The University of Glasgow 2011-- License : see libraries/base/LICENSE---- Maintainer : cvs-ghc@haskell.org-- Stability : internal-- Portability : non-portable (GHC Extensions)---- Access to GHC's call-stack simulation---- @since 4.5.0.0-----------------------------------------------------------------------------{-# LANGUAGE MagicHash, NoImplicitPrelude, ImplicitParams, RankNTypes #-}moduleGHC.Stack(errorWithStackTrace ,-- * Profiling call stackscurrentCallStack ,whoCreated ,-- * HasCallStack call stacksCallStack ,HasCallStack ,callStack ,emptyCallStack ,freezeCallStack ,fromCallSiteList ,getCallStack ,popCallStack ,prettyCallStack ,pushCallStack ,withFrozenCallStack ,-- * Source locationsSrcLoc (..),prettySrcLoc ,-- * InternalsCostCentreStack ,CostCentre ,getCurrentCCS ,getCCSOf ,clearCCS ,ccsCC ,ccsParent ,ccLabel ,ccModule ,ccSrcSpan ,ccsToStrings ,renderStack )whereimportGHC.Stack.CCS importGHC.Stack.Types importGHC.IO importGHC.Base importGHC.List importGHC.Exception -- | Like the function 'error', but appends a stack trace to the error-- message if one is available.---- @since 4.7.0.0{-# DEPRECATED errorWithStackTrace "'error' appends the call stack now" #-}-- DEPRECATED in 8.0.1errorWithStackTrace::String ->a errorWithStackTrace x =unsafeDupablePerformIO $ dostack <-ccsToStrings =<< getCurrentCCS x ifnull stack thenthrowIO (ErrorCall x )elsethrowIO (ErrorCallWithLocation x (renderStack stack ))-- | Pop the most recent call-site off the 'CallStack'.---- This function, like 'pushCallStack', has no effect on a frozen 'CallStack'.---- @since 4.9.0.0popCallStack::CallStack ->CallStack popCallStack stk =casestk ofEmptyCallStack ->errorWithoutStackTrace "popCallStack: empty stack"PushCallStack __stk' ->stk' FreezeCallStack _->stk {-# INLINE popCallStack #-}-- | Return the current 'CallStack'.---- Does *not* include the call-site of 'callStack'.---- @since 4.9.0.0callStack::HasCallStack =>CallStack callStack =popCallStack ?callStack{-# INLINE callStack #-}-- | Perform some computation without adding new entries to the 'CallStack'.---- @since 4.9.0.0withFrozenCallStack::HasCallStack =>(HasCallStack =>a )->a withFrozenCallStack do_this =-- we pop the stack before freezing it to remove-- withFrozenCallStack's call-sitelet?callStack=freezeCallStack (popCallStack callStack )indo_this 

AltStyle によって変換されたページ (->オリジナル) /