Safe Haskell | Safe-Inferred |
---|
This module provides the correct proxy implementation which strictly enforces the monad transformer laws. You can safely import this module without violating any laws or invariants.
However, I advise that you stick to the Proxy
type class API rather than
import this module so that your code works with both Proxy
implementations
and also works with all proxy transformers.
- data ProxyCorrect a' a b' b m r = Proxy {
- unProxy :: m (ProxyF a' a b' b r (ProxyCorrect a' a b' b m r))
- data ProxyF a' a b' b r x
- runProxy :: Monad m => (() -> ProxyCorrect a' () () b m r) -> m r
- runProxyK :: Monad m => (() -> ProxyCorrect a' () () b m r) -> () -> m r
- runPipe :: Monad m => ProxyCorrect a' () () b m r -> m r
Types
data ProxyCorrect a' a b' b m r Source
A ProxyCorrect
communicates with an upstream interface and a downstream
interface.
The type variables of ProxyCorrect req_a' resp_a req_b' resp_b m r
signify:
-
req_a'
- The request supplied to the upstream interface -
resp_a
- The response provided by the upstream interface -
req_b'
- The request supplied by the downstream interface -
resp_b
- The response provided to the downstream interface -
m
- The base monad -
r
- The final return value
Proxy | |
|
ProxyInternal ProxyCorrect | |
Proxy ProxyCorrect | |
ListT ProxyCorrect | |
MFunctor (ProxyCorrect a' a b' b) | |
MonadTrans (ProxyCorrect a' a b' b) | |
Monad m => Monad (ProxyCorrect a' a b' b m) | |
Monad m => Functor (ProxyCorrect a' a b' b m) | |
Monad m => Applicative (ProxyCorrect a' a b' b m) | |
MonadIO m => MonadIO (ProxyCorrect a' a b' b m) |
data ProxyF a' a b' b r x Source
The base functor for the ProxyCorrect
type
Run Sessions
The following commands run self-sufficient proxies, converting them back to the base monad.
These are the only functions specific to the ProxyCorrect
type.
Everything else programs generically over the Proxy
type class.
Use runProxyK
if you are running proxies nested within proxies. It
provides a Kleisli arrow as its result that you can pass to another
runProxy
/ runProxyK
command.
runProxy :: Monad m => (() -> ProxyCorrect a' () () b m r) -> m rSource
Run a self-sufficient ProxyCorrect
Kleisli arrow, converting it back to
the base monad
runProxyK :: Monad m => (() -> ProxyCorrect a' () () b m r) -> () -> m rSource
Run a self-sufficient ProxyCorrect
Kleisli arrow, converting it back to a
Kleisli arrow in the base monad
runPipe :: Monad m => ProxyCorrect a' () () b m r -> m rSource
Run the Pipe
monad transformer, converting it back to the base monad