Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- derive :: forall t (derived :: [Capability]) (ambient :: [Capability]) m a. (forall x. Coercible (t m x) (m x), All derived (t m), All ambient m) => (forall m'. (All derived m', All ambient m') => m' a) -> m a
Documentation
derive :: forall t (derived :: [Capability]) (ambient :: [Capability]) m a. (forall x. Coercible (t m x) (m x), All derived (t m), All ambient m) => (forall m'. (All derived m', All ambient m') => m' a) -> m a Source #
Runs an action that requires additional capabilities.
runs derive
@t @derived @ambient actact
by providing both the
capabilities in derived
and ambient
. The difference is that ambient
capabilities are assumed to be available, whereas derived
instances are
provided by t
.
derive
assumes that t
is a newtype defined in the form:
newtype T m a = T (m a)
Then derive
uses type-class instances for T
to provide for each of the
capabilities in derived
.
A common instance of this is wrapError
, whereby exceptions
raised by act
can be repackaged in a larger exception type.
The derive
function is experimental and is subject to change.