Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
A vendor responds to requests, makes requests, and performs actions
Synopsis
- newtype Vendor (up :: Type -> Type) (down :: Type -> Type) (action :: Type -> Type) = Vendor {}
- (>->) :: Vendor up middle action -> Vendor middle down action -> Vendor up down action
- id :: Vendor i i action
- function :: (forall response. down response -> response) -> Vendor up down action
- action :: (forall response. down response -> action response) -> Vendor up down action
- map :: (forall x. down x -> up x) -> Vendor up down action
- absurd :: Vendor up (Const Void) action
- run :: Monad action => Vendor (Const Void) down action -> down product -> action (Referral (Const Void) down action product)
- eval :: Vendor (Const Void) down (Const Void) -> down product -> Referral (Const Void) down (Const Void) product
- eval' :: Vendor (Const Void) down (Const Void) -> down product -> product
- alter :: (forall x. Effect up action x -> Job up' action' x) -> Vendor up down action -> Vendor up' down action'
- alter' :: (forall x. Effect up action x -> Effect up' action' x) -> Vendor up down action -> Vendor up' down action'
Type
newtype Vendor (up :: Type -> Type) (down :: Type -> Type) (action :: Type -> Type) #
Makes requests, responds to requests, and performs actions
Connection
Connect two vendors; the first interprets requests made by the second
Some simple vendors
function :: (forall response. down response -> response) -> Vendor up down action Source #
A simple stateless vendor that responds to each request by applying a pure function
action :: (forall response. down response -> action response) -> Vendor up down action Source #
A simple stateless vendor that responds to each request by applying an effectful function
map :: (forall x. down x -> up x) -> Vendor up down action Source #
A vendor that applies a transformation to each request and then simply forwards it upstream.
Running
:: Monad action | |
=> Vendor (Const Void) down action | Vendor |
-> down product | Request |
-> action (Referral (Const Void) down action product) |
Run a vendor in its action context
The vendor must not make requests, so its upstream interface
is Const Void
.
:: Vendor (Const Void) down (Const Void) | Vendor |
-> down product | Request |
-> Referral (Const Void) down (Const Void) product |
Evaluate a vendor with no context
The vendor must evokes neither request nor actions, so both
its upstream and action contexts are Const Void
.
Evaluate a vendor with no context
The vendor must evokes neither request nor actions, so both
its upstream and action contexts are Const Void
.