Movatterモバイル変換


[0]ホーム

URL:


{-# LANGUAGE Trustworthy #-}{-# LANGUAGE NoImplicitPrelude           , ExistentialQuantification           , MagicHash           , RecordWildCards           , PatternSynonyms  #-}{-# LANGUAGE TypeInType #-}{-# OPTIONS_HADDOCK hide #-}------------------------------------------------------------------------------- |-- Module      :  GHC.Exception-- Copyright   :  (c) The University of Glasgow, 1998-2002-- License     :  see libraries/base/LICENSE---- Maintainer  :  cvs-ghc@haskell.org-- Stability   :  internal-- Portability :  non-portable (GHC extensions)---- Exceptions and exception-handling functions.-------------------------------------------------------------------------------moduleGHC.Exception(moduleGHC.Exception.Type,throw,ErrorCall(..,ErrorCall),errorCallException,errorCallWithCallStackException-- re-export CallStack and SrcLoc from GHC.Types,CallStack,fromCallSiteList,getCallStack,prettyCallStack,prettyCallStackLines,showCCSStack,SrcLoc(..),prettySrcLoc)whereimportGHC.BaseimportGHC.ShowimportGHC.Stack.TypesimportGHC.OldListimportGHC.PrimimportGHC.IO.Unsafeimport{-# SOURCE#-}GHC.Stack.CCSimportGHC.Exception.Type-- | Throw an exception.  Exceptions may be thrown from purely-- functional code, but may only be caught within the 'IO' monad.throw::forall(r::RuntimeRep).forall(a::TYPEr).foralle.Exceptione=>e->athrowe=raise#(toExceptione)-- | This is thrown when the user calls 'error'. The first @String@ is the-- argument given to 'error', second @String@ is the location.dataErrorCall=ErrorCallWithLocationStringStringderiving(Eq-- ^ @since 4.7.0.0,Ord-- ^ @since 4.7.0.0)patternErrorCall::String->ErrorCallpatternErrorCallerr<-ErrorCallWithLocationerr_whereErrorCallerr=ErrorCallWithLocationerr""{-# COMPLETEErrorCall#-}-- | @since 4.0.0.0instanceExceptionErrorCall-- | @since 4.0.0.0instanceShowErrorCallwhereshowsPrec_(ErrorCallWithLocationerr"")=showStringerrshowsPrec_(ErrorCallWithLocationerrloc)=showStringerr.showChar'\n'.showStringlocerrorCallException::String->SomeExceptionerrorCallExceptions=toException(ErrorCalls)errorCallWithCallStackException::String->CallStack->SomeExceptionerrorCallWithCallStackExceptionsstk=unsafeDupablePerformIO$doccsStack<-currentCallStackletimplicitParamCallStack=prettyCallStackLinesstkccsCallStack=showCCSStackccsStackstack=intercalate"\n"$implicitParamCallStack++ccsCallStackreturn$toException(ErrorCallWithLocationsstack)showCCSStack::[String]->[String]showCCSStack[]=[]showCCSStackstk="CallStack (from -prof):":map("  "++)(reversestk)-- prettySrcLoc and prettyCallStack are defined here to avoid hs-boot-- files. See Note [Definition of CallStack]-- | Pretty print a 'SrcLoc'.---- @since 4.9.0.0prettySrcLoc::SrcLoc->StringprettySrcLocSrcLoc{..}=foldr(++)""[srcLocFile,":",showsrcLocStartLine,":",showsrcLocStartCol," in ",srcLocPackage,":",srcLocModule]-- | Pretty print a 'CallStack'.---- @since 4.9.0.0prettyCallStack::CallStack->StringprettyCallStack=intercalate"\n".prettyCallStackLinesprettyCallStackLines::CallStack->[String]prettyCallStackLinescs=casegetCallStackcsof[]->[]stk->"CallStack (from HasCallStack):":map(("  "++).prettyCallSite)stkwhereprettyCallSite(f,loc)=f++", called at "++prettySrcLocloc

[8]ページ先頭

©2009-2025 Movatter.jp