Safe Haskell | None |
---|---|
Language | Haskell2010 |
Debug.Provenance.Callback
Contents
Description
Provenance for callbacks
Synopsis
- data Callback (m :: Type -> Type) a b
- callback :: HasCallStack => (HasCallStack => a -> m b) -> Callback m a b
- invokeCallback :: HasCallStack => Callback m a b -> a -> m b
- type HasCallStack = ?callStack :: CallStack
Callbacks
data Callback (m :: Type -> Type) a b Source #
Callback of type (a -> m b)
When we invoke a callback, it is useful to distinguish between two things:
The purpose of this module is to be careful about this distinction; a
HasCallStack
backtrace originating from an invocation of a callback will
look something like this:
gM, called at .. .. g2, called at .. g1, called at .. callbackFn, called at .. invoking callback defined at <callSite> invokeCallback, called at .. fN, called at .. .. f2, called at .. f1, called at ..
where
f1 .. fN
are the function calls leading up to the callbackg1 .. gM
are the function calls made inside of the callback<callSite>
tells us where the callback was defined
callback :: HasCallStack => (HasCallStack => a -> m b) -> Callback m a b Source #
Define Callback
See Callback
for discussion and motivation of the two HasCallStack
constraints.
invokeCallback :: HasCallStack => Callback m a b -> a -> m b Source #
Invoke Callback
Convenience re-exports
type HasCallStack = ?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.
@since base-4.9.0.0