LanguageExt.Pipes

LanguageExt.Pipes Consumer

Contents

class Consumer Source #

Consumers both can only be awaiting

  Upstream | Downstream
      +---------+
      |         |
Unit <==       <== Unit
      |         |
 IN  ==>       ==> Void
      |    |    |
      +----|----+
           |
           A

Methods

method Consumer<A, M, R> Pure <A, M, R> (R value) Source #

where M : Monad<M>

Monad return / pure

method Consumer<A, M, A> awaiting <M, A> () Source #

where M : Monad<M>

Wait for a value from upstream (whilst in a consumer)

method Consumer<A, M, R> lift <A, M, R> (K<M, R> ma) Source #

where M : Monad<M>

Lift the IO monad into the Consumer monad transformer (a specialism of the Proxy monad transformer)

method Consumer<A, M, R> liftIO <A, M, R> (IO<R> ma) Source #

where M : Monad<M>

Lift the IO monad into the Consumer monad transformer (a specialism of the Proxy monad transformer)

method Consumer<A, M, R> mapM <A, M, R> (Func<A, K<M, Unit>> f) Source #

where M : Monad<M>

Consume all values using a monadic function

method Consumer<A, M, R> mapM <A, M, R> (Func<A, IO<Unit>> f) Source #

where M : Monad<M>

Consume all values using a monadic function

record Consumer <IN, M, A> Source #

where M : Monad<M>

Consumers both can only be awaiting

  Upstream | Downstream
      +---------+
      |         |
Unit <==       <== Unit
      |         |
 IN  ==>       ==> Void
      |    |    |
      +----|----+
           |
           A

Fields

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

Constructors

constructor Consumer (Proxy<Unit, IN, Unit, Void, M, A> value) Source #

Constructor

Parameters

param value

Correctly shaped Proxy that represents a Consumer

Methods

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

Calling this will effectively cast the sub-type 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<Unit, IN, Unit, Void, M, S> Bind <S> (Func<A, Proxy<Unit, IN, Unit, Void, M, S>> 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<Unit, IN, 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<Unit, IN, 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 Consumer<IN, M, B> Bind <B> (Func<A, Consumer<IN, 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 Consumer<IN, M, B> Bind <B> (Func<A, K<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<Unit, IN, Unit, Void, M, S> Map <S> (Func<A, S> 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 Consumer<IN, M, C> SelectMany <B, C> (Func<A, Consumer<IN, M, B>> f, Func<A, B, C> project) 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 Consumer<IN, M, C> SelectMany <B, C> (Func<A, K<M, B>> f, Func<A, B, C> project) 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 Consumer<IN, 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<Unit, IN, C1, C, M, A> For <C1, C> (Func<Void, Proxy<Unit, IN, 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<Unit, IN, Unit, Void, M, S> Action <S> (Proxy<Unit, IN, 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<Unit, Proxy<UOutA, AUInA, Unit, IN, 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<Unit, Proxy<UOutA, AUInA, Unit, Void, M, IN>> 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<Unit, IN, 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<Unit, IN, DInC, DOutC, M, A> ReplaceRespond <DInC, DOutC> ( Func<Void, Proxy<Unit, IN, 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, IN, Unit, M, A> Reflect () Source #

Reverse the arrows of the Proxy to find its dual.

Parameters

returns

The dual of this

method Proxy<Unit, IN, 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<Unit, IN, Unit, Void, M, A> value) Source #

method Consumer<IN, M, C> SelectMany <B, C> (Func<A, Consumer<IN, B>> bind, Func<A, B, C> project) 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 string ToString () Source #

Operators

operator | (IN p1, Consumer<IN, M, A?> p2) Source #

Compose an IN and a Consumer together into an Effect. This effectively creates a singleton Producer from the IN value, and composes it with the Consumer into an Effect that can be run.

Parameters

param p1

Single input value

param p2

Consumer

returns

Effect

operator & ( Consumer<IN, M, A> lhs, Consumer<IN, M, A> rhs) Source #

Chain one consumer's set of awaits after another