ghc-internal-9.1001.0: Basic libraries
Copyright(c) The University of Glasgow 1998-2002
Licensesee libraries/base/LICENSE
Portabilitynon-portable (GHC extensions)
Safe HaskellNone



Exception context type.


Exception context

data ExceptionContext Source #

Exception context represents a list of ExceptionAnnotations. These are attached to SomeExceptions via addExceptionContext and can be used to capture various ad-hoc metadata about the exception including backtraces and application-specific context.

ExceptionContexts can be merged via concatenation using the Semigroup instance or mergeExceptionContext.

Note that GHC will automatically solve implicit constraints of type ExceptionContext with emptyExceptionContext.

emptyExceptionContext :: ExceptionContext Source #

An ExceptionContext containing no annotations.

Since: base-

getExceptionAnnotations :: ExceptionAnnotation a => ExceptionContext -> [a] Source #

Retrieve all ExceptionAnnotations of the given type from an ExceptionContext.

Since: base-

mergeExceptionContext :: ExceptionContext -> ExceptionContext -> ExceptionContext Source #

Merge two ExceptionContexts via concatenation

Since: base-

displayExceptionContext :: ExceptionContext -> String Source #

Render ExceptionContext to a human-readable String.

Since: base-

Exception annotations

class Typeable a => ExceptionAnnotation a where Source #

ExceptionAnnotations are types which can decorate exceptions as ExceptionContext.

Since: base-

Minimal complete definition



displayExceptionAnnotation :: a -> String Source #

Render the annotation for display to the user.