| Safe Haskell | Safe |
|---|---|
| Language | Haskell98 |
Control.Proxy.Class
Description
This module provides an abstract interface to Proxy-like behavior, so that
multiple proxy implementations can share the same library of utility
proxies.
Proxy composition
class Channel p where Source #
The Channel class defines an interface to a bidirectional flow of
information.
Laws:
idT >-> f = f f >-> idT = f (f >-> g) >-> h = f >-> (g >-> h)
Minimal complete definition:
Minimal complete definition
Methods
idT :: Monad m => a' -> p a' a a' a m r Source #
idT acts like a 'T'ransparent proxy, passing all requests further
upstream, and passing all responses further downstream.
(>->) :: Monad m => (b' -> p a' a b' b m r) -> (c' -> p b' b c' c m r) -> c' -> p a' a c' c m r infixl 7 Source #
Compose two proxies, satisfying all requests from downstream with responses from upstream.
(<-<) :: Monad m => (c' -> p b' b c' c m r) -> (b' -> p a' a b' b m r) -> c' -> p a' a c' c m r infixr 7 Source #
Compose two proxies, satisfying all requests from downstream with responses from upstream.
Proxy request and respond
class Interact p where Source #
The Interact class defines the ability to:
- Request input using the
requestcommand - Replace existing
requestcommands using (\>\) - Respond with output using the
respondcommand - Replace existing
respondcommands using (/>/)
Laws:
request \>\ f = f f \>\ request = f (f \>\ g) \>\ h = f \>\ (g \>\ h)
respond />/ f = f f />/ respond = f (f />/ g) />/ h = f />/ (g />/ h)
Minimal complete definition:
Methods
request :: Monad m => a' -> p a' a x' x m a Source #
request input from upstream, passing an argument with the request
request a' passes a' as a parameter to upstream that upstream may
use to decide what response to return. request binds the upstream's
response to its own return value.
(\>\) :: Monad m => (b' -> p a' a x' x m b) -> (c' -> p b' b x' x m c) -> c' -> p a' a x' x m c infixl 8 Source #
f \>\ g replaces all requests in g with f.
(/</) :: Monad m => (c' -> p b' b x' x m c) -> (b' -> p a' a x' x m b) -> c' -> p a' a x' x m c infixr 8 Source #
f /</ g replaces all requests in f with g.
respond :: Monad m => a -> p x' x a' a m a' Source #
respond with an output for downstream and bind downstream's next
request
respond b satisfies a downstream request by supplying the value b
respond blocks until downstream requests a new value and binds the
argument from the next request as its return value.
(/>/) :: Monad m => (a -> p x' x b' b m a') -> (b -> p x' x c' c m b') -> a -> p x' x c' c m a' infixr 8 Source #
f />/ g replaces all responds in f with g.
(\<\) :: Monad m => (b -> p x' x c' c m b') -> (a -> p x' x b' b m a') -> a -> p x' x c' c m a' infixl 8 Source #
f \<\ g replaces all responds in g with f.