Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- interpret :: FirstOrder e "interpret" => (forall x m. e m x -> Semantic r x) -> Semantic (e ': r) a -> Semantic r a
- intercept :: (Member e r, FirstOrder e "intercept") => (forall x m. e m x -> Semantic r x) -> Semantic r a -> Semantic r a
- reinterpret :: FirstOrder e1 "reinterpret" => (forall m x. e1 m x -> Semantic (e2 ': r) x) -> Semantic (e1 ': r) a -> Semantic (e2 ': r) a
- reinterpret2 :: FirstOrder e1 "reinterpret2" => (forall m x. e1 m x -> Semantic (e2 ': (e3 ': r)) x) -> Semantic (e1 ': r) a -> Semantic (e2 ': (e3 ': r)) a
- reinterpret3 :: FirstOrder e1 "reinterpret3" => (forall m x. e1 m x -> Semantic (e2 ': (e3 ': (e4 ': r))) x) -> Semantic (e1 ': r) a -> Semantic (e2 ': (e3 ': (e4 ': r))) a
- interpretH :: (forall x m. e m x -> Tactical e m r x) -> Semantic (e ': r) a -> Semantic r a
- interceptH :: Member e r => (forall x m. e m x -> Tactical e m r x) -> Semantic r a -> Semantic r a
- reinterpretH :: (forall m x. e1 m x -> Tactical e1 m (e2 ': r) x) -> Semantic (e1 ': r) a -> Semantic (e2 ': r) a
- reinterpret2H :: (forall m x. e1 m x -> Tactical e1 m (e2 ': (e3 ': r)) x) -> Semantic (e1 ': r) a -> Semantic (e2 ': (e3 ': r)) a
- reinterpret3H :: (forall m x. e1 m x -> Tactical e1 m (e2 ': (e3 ': (e4 ': r))) x) -> Semantic (e1 ': r) a -> Semantic (e2 ': (e3 ': (e4 ': r))) a
- stateful :: Typeable s => (forall x m. e m x -> s -> Semantic r (s, x)) -> s -> Semantic (e ': r) a -> Semantic r (s, a)
- lazilyStateful :: Typeable s => (forall x m. e m x -> s -> Semantic r (s, x)) -> s -> Semantic (e ': r) a -> Semantic r (s, a)
First order
:: FirstOrder e "interpret" | |
=> (forall x m. e m x -> Semantic r x) | A natural transformation from the handled effect to other effects
already in |
-> Semantic (e ': r) a | |
-> Semantic r a |
The simplest way to produce an effect handler. Interprets an effect e
by
transforming it into other effects inside of r
.
:: (Member e r, FirstOrder e "intercept") | |
=> (forall x m. e m x -> Semantic r x) | A natural transformation from the handled effect to other effects
already in |
-> Semantic r a | |
-> Semantic r a |
Like interpret
, but instead of handling the effect, allows responding to
the effect while leaving it unhandled. This allows you, for example, to
intercept other effects and insert logic around them.
:: FirstOrder e1 "reinterpret" | |
=> (forall m x. e1 m x -> Semantic (e2 ': r) x) | A natural transformation from the handled effect to the new effect. |
-> Semantic (e1 ': r) a | |
-> Semantic (e2 ': r) a |
Like interpret
, but instead of removing the effect e
, reencodes it in
some new effect f
. This function will fuse when followed by
runState
, meaning it's free to reinterpret
in terms of
the State
effect and immediately run it.
:: FirstOrder e1 "reinterpret2" | |
=> (forall m x. e1 m x -> Semantic (e2 ': (e3 ': r)) x) | A natural transformation from the handled effect to the new effects. |
-> Semantic (e1 ': r) a | |
-> Semantic (e2 ': (e3 ': r)) a |
Like reinterpret
, but introduces two intermediary effects.
:: FirstOrder e1 "reinterpret3" | |
=> (forall m x. e1 m x -> Semantic (e2 ': (e3 ': (e4 ': r))) x) | A natural transformation from the handled effect to the new effects. |
-> Semantic (e1 ': r) a | |
-> Semantic (e2 ': (e3 ': (e4 ': r))) a |
Like reinterpret
, but introduces three intermediary effects.
Higher order
:: Member e r | |
=> (forall x m. e m x -> Tactical e m r x) | A natural transformation from the handled effect to other effects
already in |
-> Semantic r a | Unlike |
-> Semantic r a |
Like interceptH
, but for higher-order effects.
See the notes on Tactical
for how to use this function.
:: (forall m x. e1 m x -> Tactical e1 m (e2 ': r) x) | A natural transformation from the handled effect to the new effect. |
-> Semantic (e1 ': r) a | |
-> Semantic (e2 ': r) a |
Like reinterpret
, but for higher-order effects.
See the notes on Tactical
for how to use this function.
:: (forall m x. e1 m x -> Tactical e1 m (e2 ': (e3 ': r)) x) | A natural transformation from the handled effect to the new effects. |
-> Semantic (e1 ': r) a | |
-> Semantic (e2 ': (e3 ': r)) a |
Like reinterpret2
, but for higher-order effects.
See the notes on Tactical
for how to use this function.
:: (forall m x. e1 m x -> Tactical e1 m (e2 ': (e3 ': (e4 ': r))) x) | A natural transformation from the handled effect to the new effects. |
-> Semantic (e1 ': r) a | |
-> Semantic (e2 ': (e3 ': (e4 ': r))) a |
Like reinterpret3
, but for higher-order effects.
See the notes on Tactical
for how to use this function.