Safe Haskell | Safe |
---|---|
Language | Haskell98 |
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 interfaceresp_a
- The response provided by the upstream interfacereq_b'
- The request supplied by the downstream interfaceresp_b
- The response provided to the downstream interfacem
- The base monadr
- The final return value
Proxy | |
|
MonadIOP ProxyCorrect Source # | |
Interact ProxyCorrect Source # | |
Proxy ProxyCorrect Source # | |
MonadTrans (ProxyCorrect a' a b' b) Source # | |
MFunctor (ProxyCorrect a' a b' b) Source # | |
Monad m => Monad (ProxyCorrect a' a b' b m) Source # | |
Monad m => Functor (ProxyCorrect a' a b' b m) Source # | |
Monad m => Applicative (ProxyCorrect a' a b' b m) Source # | |
MonadIO m => MonadIO (ProxyCorrect a' a b' b m) Source # | |
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 r Source #
Run a self-sufficient ProxyCorrect
Kleisli arrow, converting it back to
the base monad
runProxyK :: Monad m => (() -> ProxyCorrect a' () () b m r) -> () -> m r Source #
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 r Source #
Run the Pipe
monad transformer, converting it back to the base monad