LanguageExt.Core

LanguageExt.Core Effects Pipes Pipe

Contents

class Pipe <RT, IN, OUT, A> Source #

where RT : struct, HasCancel<RT>

Pipes both can both be await and can yield

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

Fields

field Proxy<RT, Unit, IN, Unit, OUT, A> Value Source #

Constructors

constructor Pipe (Proxy<RT, Unit, IN, Unit, OUT, A> value) Source #

Constructor

Parameters

param value

Correctly shaped Proxy that represents a Pipe

Methods

method Proxy<RT, Unit, IN, Unit, OUT, 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<RT, Unit, IN, Unit, OUT, S> Bind <S> (Func<A, Proxy<RT, Unit, IN, Unit, OUT, 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<RT, Unit, IN, Unit, OUT, 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 Pipe<RT, IN, OUT, B> Bind <B> (Func<A, Pipe<RT, IN, OUT, 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 Pipe<RT, IN, OUT, 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<RT, Unit, IN, C1, C, A> For <C1, C> (Func<OUT, Proxy<RT, Unit, IN, C1, C, 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<RT, Unit, IN, Unit, OUT, S> Action <S> (Proxy<RT, Unit, IN, Unit, OUT, S> r) Source #

Applicative action

Invokes this Proxy, then the Proxy r

Parameters

param r

Proxy to run after this one

method Proxy<RT, UOutA, AUInA, Unit, OUT, A> PairEachRequestWithRespond <UOutA, AUInA> (Func<Unit, Proxy<RT, UOutA, AUInA, Unit, IN, 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<RT, UOutA, AUInA, Unit, OUT, A> ReplaceRequest <UOutA, AUInA> (Func<Unit, Proxy<RT, UOutA, AUInA, Unit, OUT, 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<RT, Unit, IN, DInC, DOutC, A> PairEachRespondWithRequest <DInC, DOutC> (Func<OUT, Proxy<RT, Unit, OUT, DInC, DOutC, 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<RT, Unit, IN, DInC, DOutC, A> ReplaceRespond <DInC, DOutC> (Func<OUT, Proxy<RT, Unit, IN, DInC, DOutC, 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<RT, OUT, Unit, IN, Unit, A> Reflect () Source #

Reverse the arrows of the Proxy to find its dual.

Parameters

returns

The dual of this

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

method Pipe<RT, IN, C, A> Then <C> (Pipe<RT, OUT, C, A> pipe) Source #

Composition chaining of two pipes.

We can't provide the operator overloading to chain two pipes together, because operators don't have generics of their own. And so we can use this method to chain to pipes together.

Parameters

type C

Type of value that the right hand side pipe yields

param pipe

Right hand side Pipe

returns

A composition of this pipe and the Pipe provided

method Pipe<RT, IN, OUT, B> SelectMany <B> (Func<A, Release<B>> bind) 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 Pipe<RT, IN, OUT, C> SelectMany <B, C> (Func<A, Release<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 Pipe<RT, IN, OUT, B> SelectMany <B> (Func<A, Pipe<IN, OUT, B>> bind) 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 Pipe<RT, IN, OUT, C> SelectMany <B, C> (Func<A, Pipe<IN, OUT, 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 Pipe<RT, IN, OUT, B> SelectMany <B> (Func<A, Pipe<RT, IN, OUT, 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 Pipe<RT, IN, OUT, C> SelectMany <B, C> (Func<A, Pipe<RT, IN, OUT, 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

Operators

operator | (Producer<RT, IN, A> p1, Pipe<RT, IN, OUT, A> p2) Source #

Compose a Producer and a Pipe together into a Producer.

Parameters

param p1

Producer

param p2

Pipe

returns

Producer

operator | (Producer<IN, A> p1, Pipe<RT, IN, OUT, A> p2) Source #

Compose a Producer and a Pipe together into a Producer.

Parameters

param p1

Producer

param p2

Pipe

returns

Producer

operator | (Producer<OUT, IN> p1, Pipe<RT, IN, OUT, A> p2) Source #

Compose a Producer and a Pipe together into a Producer.

Parameters

param p1

Producer

param p2

Pipe

returns

Producer

operator | (Pipe<RT, IN, OUT, A> p1, Consumer<OUT, A> p2) Source #

Compose a Pipe and a Consumer together into a Consumer.

Parameters

param p1

Pipe

param p2

Consumer

returns

Consumer

operator | (Pipe<RT, IN, OUT, A> p1, Consumer<RT, OUT, A> p2) Source #

Compose a Pipe and a Consumer together into a Consumer.

Parameters

param p1

Pipe

param p2

Consumer

returns

Consumer

operator & ( Pipe<RT, IN, OUT, A> lhs, Pipe<RT, IN, OUT, A> rhs) Source #

Chain one pipe's set of awaits and yields after another

class Pipe Source #

Pipes both can both be await and can yield

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

Methods

method Pipe<RT, A, B, R> Pure <RT, A, B, R> (R value) Source #

where RT : struct, HasCancel<RT>

Monad return / pure

method Pipe<RT, A, Y, A> awaiting <RT, A, Y> () Source #

where RT : struct, HasCancel<RT>

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

This is the version of await that works for pipes. In consumers, use Consumer.await

method Pipe<RT, IN, OUT, Unit> yield <RT, IN, OUT> (OUT value) Source #

where RT : struct, HasCancel<RT>

Send a value downstream (whilst in a pipe)

This is the version of yield that works for pipes. In producers, use Producer.yield

method Pipe<RT, IN, OUT, Unit> yieldAll <RT, IN, OUT> (IAsyncEnumerable<OUT> xs) Source #

where RT : struct, HasCancel<RT>

method Pipe<RT, IN, OUT, Unit> yieldAll <RT, IN, OUT> (IObservable<OUT> xs) Source #

where RT : struct, HasCancel<RT>

method Pipe<RT, A, A, Unit> filter <RT, A> (Func<A, bool> f) Source #

where RT : struct, HasCancel<RT>

Only forwards values that satisfy the predicate.

method Pipe<RT, A, B, R> map <RT, A, B, R> (Func<A, B> f) Source #

where RT : struct, HasCancel<RT>

Map the output of the pipe (not the bound value as is usual with Map)

method Pipe<RT, A, B, Unit> map <RT, A, B> (Func<A, B> f) Source #

where RT : struct, HasCancel<RT>

Map the output of the pipe (not the bound value as is usual with Map)

method Pipe<A, B, Unit> map <A, B> (Func<A, B> f) Source #

Map the output of the pipe (not the bound value as is usual with Map)

method Pipe<RT, A, B, R> mapM <RT, A, B, R> (Func<A, Aff<RT, B>> f) Source #

where RT : struct, HasCancel<RT>

Apply a monadic function to all values flowing downstream (not the bound value as is usual with Map)

method Pipe<RT, A, A, Unit> mapM <RT, A> (Func<A, Aff<RT, A>> f) Source #

where RT : struct, HasCancel<RT>

Apply a monadic function to all values flowing downstream (not the bound value as is usual with Map)

method Pipe<RT, A, B, R> mapM <RT, A, B, R> (Func<A, Aff<B>> f) Source #

where RT : struct, HasCancel<RT>

Apply a monadic function to all values flowing downstream (not the bound value as is usual with Map)

method Pipe<RT, A, B, R> mapM <RT, A, B, R> (Func<A, Eff<RT, B>> f) Source #

where RT : struct, HasCancel<RT>

Apply a monadic function to all values flowing downstream (not the bound value as is usual with Map)

method Pipe<RT, A, A, Unit> mapM <RT, A> (Func<A, Eff<RT, A>> f) Source #

where RT : struct, HasCancel<RT>

Apply a monadic function to all values flowing downstream (not the bound value as is usual with Map)

method Pipe<RT, A, B, R> mapM <RT, A, B, R> (Func<A, Eff<B>> f) Source #

where RT : struct, HasCancel<RT>

Apply a monadic function to all values flowing downstream (not the bound value as is usual with Map)

method Pipe<RT, A, B, R> lift <RT, A, B, R> (Aff<R> ma) Source #

where RT : struct, HasCancel<RT>

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

method Pipe<RT, A, B, R> lift <RT, A, B, R> (Eff<R> ma) Source #

where RT : struct, HasCancel<RT>

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

method Pipe<RT, A, B, R> lift <RT, A, B, R> (Aff<RT, R> ma) Source #

where RT : struct, HasCancel<RT>

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

method Pipe<RT, A, B, R> lift <RT, A, B, R> (Eff<RT, R> ma) Source #

where RT : struct, HasCancel<RT>

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

method Pipe<RT, IN, OUT, R> use <RT, IN, OUT, R> (Aff<R> ma) Source #

where RT : struct, HasCancel<RT>
where R : IDisposable

Lift am IO monad into the Proxy monad transformer

method Pipe<RT, IN, OUT, R> use <RT, IN, OUT, R> (Eff<R> ma) Source #

where RT : struct, HasCancel<RT>
where R : IDisposable

Lift am IO monad into the Proxy monad transformer

method Pipe<RT, IN, OUT, R> use <RT, IN, OUT, R> (Aff<RT, R> ma) Source #

where RT : struct, HasCancel<RT>
where R : IDisposable

Lift am IO monad into the Proxy monad transformer

method Pipe<RT, IN, OUT, R> use <RT, IN, OUT, R> (Eff<RT, R> ma) Source #

where RT : struct, HasCancel<RT>
where R : IDisposable

Lift am IO monad into the Proxy monad transformer

method Pipe<RT, IN, OUT, R> use <RT, IN, OUT, R> (Aff<R> ma, Func<R, Unit> dispose) Source #

where RT : struct, HasCancel<RT>

Lift am IO monad into the Proxy monad transformer

method Pipe<RT, IN, OUT, R> use <RT, IN, OUT, R> (Eff<R> ma, Func<R, Unit> dispose) Source #

where RT : struct, HasCancel<RT>

Lift am IO monad into the Proxy monad transformer

method Pipe<RT, IN, OUT, R> use <RT, IN, OUT, R> (Aff<RT, R> ma, Func<R, Unit> dispose) Source #

where RT : struct, HasCancel<RT>

Lift am IO monad into the Proxy monad transformer

method Pipe<RT, IN, OUT, R> use <RT, IN, OUT, R> (Eff<RT, R> ma, Func<R, Unit> dispose) Source #

where RT : struct, HasCancel<RT>

Lift am IO monad into the Proxy monad transformer

method Pipe<RT, IN, OUT, Unit> release <RT, IN, OUT, R> (R dispose) Source #

where RT : struct, HasCancel<RT>

Release a previously used resource

method Pipe<RT, IN, OUT, Unit> foldWhile <RT, IN, OUT> (OUT Initial, Func<OUT, IN, OUT> Fold, Func<OUT, bool> WhileState) Source #

where RT : struct, HasCancel<RT>

Folds values coming down-stream, when the predicate returns false the folded value is yielded

Parameters

param Initial

Initial state

param Fold

Fold operation

param WhileState

Predicate

returns

A pipe that folds

method Pipe<RT, IN, OUT, Unit> foldUntil <RT, IN, OUT> (OUT Initial, Func<OUT, IN, OUT> Fold, Func<OUT, bool> UntilState) Source #

where RT : struct, HasCancel<RT>

Folds values coming down-stream, when the predicate returns true the folded value is yielded

Parameters

param Initial

Initial state

param Fold

Fold operation

param UntilState

Predicate

returns

A pipe that folds

method Pipe<RT, IN, OUT, Unit> foldWhile <RT, IN, OUT> (OUT Initial, Func<OUT, IN, OUT> Fold, Func<IN, bool> WhileValue) Source #

where RT : struct, HasCancel<RT>

Folds values coming down-stream, when the predicate returns false the folded value is yielded

Parameters

param Initial

Initial state

param Fold

Fold operation

param WhileValue

Predicate

returns

A pipe that folds

method Pipe<RT, IN, OUT, Unit> foldUntil <RT, IN, OUT> (OUT Initial, Func<OUT, IN, OUT> Fold, Func<IN, bool> UntilValue) Source #

where RT : struct, HasCancel<RT>

Folds values coming down-stream, when the predicate returns true the folded value is yielded

Parameters

param Initial

Initial state

param Fold

Fold operation

param UntilValue

Predicate

returns

A pipe that folds

method Pipe<RT, IN, OUT, Unit> scan <RT, IN, OUT, S> (Func<S, IN, S> Step, S Begin, Func<S, OUT> Done) Source #

where RT : struct, HasCancel<RT>

Strict left scan