LanguageExt.Pipes

LanguageExt.Pipes Client

Contents

class Client Source #

Client sends requests of type REQ and receives responses of type RES.

Clients only request and never respond.

  Upstream | Downstream
      +---------+
      |         |
REQ 〈==      〈== Unit
      |         |
RES  ==〉      ==〉Void
      |    |    |
      +----|----+
           |
           A

Methods

method Client<REQ, RES, M, R> Pure <REQ, RES, M, R> (R value) Source #

where M : Monad<M>

Monad return / pure

method Client<REQ, RES, M, RES> request <REQ, M, RES> (REQ value) Source #

where M : Monad<M>

Send a value of type RES downstream and block waiting for a reply of type REQ

respond is the identity of the respond category.

method Client<REQ, RES, M, R> lift <REQ, RES, M, R> (K<M, R> ma) Source #

where M : Monad<M>

Lift am IO monad into the Proxy monad transformer

method Client<REQ, RES, M, R> liftIO <REQ, RES, M, R> (IO<R> ma) Source #

where M : Monad<M>

Lift am IO monad into the Proxy monad transformer

record Client <REQ, RES, M, A> Source #

where M : Monad<M>

Client sends requests of type REQ and receives responses of type RES.

Clients only request and never respond.

  Upstream | Downstream
      +---------+
      |         |
REQ 〈==      〈== Unit
      |         |
RES  ==〉      ==〉Void
      |    |    |
      +----|----+
           |
           A

Fields

field Proxy<REQ, RES, Unit, Void, M, A> Value Source #

Constructors

constructor Client (Proxy<REQ, RES, Unit, Void, M, A> value) Source #

Constructor

Parameters

param value

Correctly shaped Proxy that represents a Client

Methods

method Proxy<REQ, RES, Unit, Void, M, A> ToProxy () Source #

Calling this will effectively cast the subtype to the base.

This type wraps up a Proxy for convenience, and so it's a Proxy proxy. So calling this method isn't exactly the same as a cast operation, as it unwraps the Proxy from within. It has the same effect however, and removes a level of indirection

Parameters

returns

A general Proxy type from a more specialised type

method Proxy<REQ, RES, Unit, Void, M, B> Bind <B> (Func<A, Proxy<REQ, RES, Unit, Void, M, B>> f) Source #

Monadic bind operation, for chaining Proxy computations together.

Parameters

type B

The mapped bound value type

param f

The bind function

returns

A new Proxy that represents the composition of this Proxy and the result of the bind operation

method Proxy<REQ, RES, Unit, Void, M, B> Map <B> (Func<A, B> f) Source #

Lifts a pure function into the Proxy domain, causing it to map the bound value within

Parameters

type B

The mapped bound value type

param f

The map function

returns

A new Proxy that represents the composition of this Proxy and the result of the map operation

method Proxy<REQ, RES, Unit, Void, M, B> MapM <B> (Func<K<M, A>, K<M, B>> f) Source #

Map the lifted monad

Parameters

type B

The mapped bound value type

param f

The map function

returns

A new Proxy that represents the composition of this Proxy and the result of the map operation

method Proxy<REQ, RES, Unit, Void, M, IO<A>> ToIO () Source #

Extract the lifted IO monad (if there is one)

Parameters

param f

The map function

returns

A new Proxy that represents the innermost IO monad, if it exists.

method Client<REQ, RES, M, B> Bind <B> (Func<A, Client<REQ, RES, M, B>> f) Source #

Monadic bind operation, for chaining Client computations together.

Parameters

type B

The mapped bound value type

param f

The bind function

returns

A new Proxy that represents the composition of this Proxy and the result of the bind operation

method Client<REQ, RES, M, B> SelectMany <B> (Func<A, Client<REQ, RES, M, B>> f) Source #

Monadic bind operation, for chaining Client computations together.

Parameters

type B

The mapped bound value type

param f

The bind function

returns

A new Proxy that represents the composition of this Proxy and the result of the bind operation

method Client<REQ, RES, M, C> SelectMany <B, C> (Func<A, Client<REQ, RES, M, B>> f, Func<A, B, C> project) Source #

Monadic bind operation, for chaining Client computations together.

Parameters

type B

The mapped bound value type

param f

The bind function

returns

A new Proxy that represents the composition of this Proxy and the result of the bind operation

method Client<REQ, RES, M, B> Select <B> (Func<A, B> f) Source #

Lifts a pure function into the Proxy domain, causing it to map the bound value within

Parameters

type B

The mapped bound value type

param f

The map function

returns

A new Proxy that represents the composition of this Proxy and the result of the map operation

method Proxy<REQ, RES, C1, C, M, A> For <C1, C> (Func<Void, Proxy<REQ, RES, C1, C, M, Unit>> body) Source #

For(body) loops over the Proxy p replacing each yield with body

Parameters

param body

Any yield found in the Proxy will be replaced with this function. It will be composed so that the value yielded will be passed to the argument of the function. That returns a Proxy to continue the processing of the computation

returns

A new Proxy that represents the composition of this Proxy and the function provided

method Proxy<REQ, RES, Unit, Void, M, S> Action <S> (Proxy<REQ, RES, Unit, Void, M, S> r) Source #

Applicative action

Invokes this Proxy, then the Proxy r

Parameters

param r

Proxy to run after this one

method Proxy<UOutA, AUInA, Unit, Void, M, A> PairEachRequestWithRespond <UOutA, AUInA> (Func<REQ, Proxy<UOutA, AUInA, REQ, RES, M, A>> lhs) Source #

Used by the various composition functions and when composing proxies with the | operator. You usually wouldn't need to call this directly, instead either pipe them using | or call Proxy.compose(lhs, rhs)

(f +>> p) pairs each 'request' in this with a 'respond' in lhs.

method Proxy<UOutA, AUInA, Unit, Void, M, A> ReplaceRequest <UOutA, AUInA> (Func<REQ, Proxy<UOutA, AUInA, Unit, Void, M, RES>> lhs) Source #

Used by the various composition functions and when composing proxies with the | operator. You usually wouldn't need to call this directly, instead either pipe them using | or call Proxy.compose(lhs, rhs)

method Proxy<REQ, RES, DInC, DOutC, M, A> PairEachRespondWithRequest <DInC, DOutC> (Func<Void, Proxy<Unit, Void, DInC, DOutC, M, A>> rhs) Source #

Used by the various composition functions and when composing proxies with the | operator. You usually wouldn't need to call this directly, instead either pipe them using | or call Proxy.compose(lhs, rhs)

method Proxy<REQ, RES, DInC, DOutC, M, A> ReplaceRespond <DInC, DOutC> (Func<Void, Proxy<REQ, RES, DInC, DOutC, M, Unit>> rhs) Source #

Used by the various composition functions and when composing proxies with the | operator. You usually wouldn't need to call this directly, instead either pipe them using | or call Proxy.compose(lhs, rhs)

method Proxy<Void, Unit, RES, REQ, M, A> Reflect () Source #

Reverse the arrows of the Proxy to find its dual.

Parameters

returns

The dual of this

method Proxy<REQ, RES, Unit, Void, M, A> Observe () Source #

Observe(lift (Pure(r))) = Observe(Pure(r))
Observe(lift (m.Bind(f))) = Observe(lift(m.Bind(x => lift(f(x)))))

This correctness comes at a small cost to performance, so use this function sparingly. This function is a convenience for low-level pipes implementers. You do not need to use observe if you stick to the safe API.

method void Deconstruct (out Proxy<REQ, RES, Unit, Void, M, A> value) Source #

method string ToString () Source #

Operators

operator | (Func<REQ, Server<REQ, RES, M, A>> x, Client<REQ, RES, M, A> y) Source #

Compose a Server and a Client together into an Effect. Note the Server is provided as a function that takes a value of REQ. This is how we model the request coming into the Server. The resulting Server computation can then call Server.respond(response) to reply to the Client.

The Client simply calls Client.request(req) to post a request to the Server, it is like an awaiting that also posts. It will await the response from the Server.

Parameters

param x

Server

param y

Client

returns

Effect

operator & ( Client<REQ, RES, M, A> lhs, Client<REQ, RES, M, A> rhs) Source #

Chain one client after another