HORIZON HASKELLDocslts/ghc-9.14.x6d5fdfd2026-10-12Search packagesCtrl K
Theme: |

GHC 9.14.1 · lts/ghc-9.14.x · 6d5fdfd · 2026-10-12

Setting expectations

Expecting exceptions

Selecting exceptions

typetype Selector a = a -> Bool

A Selector is a predicate; it can simultaneously constrain the type and value of an exception.

Predefined type-based selectors

There are predefined selectors for some standard exceptions. Each selector is just const True with an appropriate type.

Combinators for defining value-based selectors

Some exceptions (most prominently ErrorCall) have no Eq instance. Selecting a specific value would require pattern matching.

For such exceptions, combinators that construct selectors are provided. Each combinator corresponds to a constructor; it takes the same arguments, and has the same name (but starting with a lower-case letter).

Re-exports

typetype HasCallStack = IP "callStack" CallStack

Request a CallStack.

NOTE: The implicit parameter ?callStack :: CallStack is an implementation detail and should not be considered part of the CallStack API, we may decide to change the implementation in the future.