LanguageExt.Core

LanguageExt.Core Effects Pipes Producer

Contents

class Producer <RT, OUT, A> Source #

where RT : struct, HasCancel<RT>

Producers can only yield

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

Fields

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

Constructors

constructor Producer (Proxy<RT, Void, Unit, Unit, OUT, A> value) Source #

Constructor

Parameters

param value

Correctly shaped Proxy that represents a Producer

Methods

method Proxy<RT, Void, Unit, 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, Void, Unit, Unit, OUT, S> Bind <S> (Func<A, Proxy<RT, Void, Unit, 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, Void, Unit, Unit, OUT, 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 Producer<RT, OUT, B> Bind <B> (Func<A, Producer<RT, 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 Producer<RT, OUT, B> SelectMany <B> (Func<A, Producer<RT, 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 Producer<RT, OUT, C> SelectMany <B, C> (Func<A, Producer<RT, 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

method Producer<RT, 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, Void, Unit, C1, C, A> For <C1, C> (Func<OUT, Proxy<RT, Void, Unit, 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, Void, Unit, Unit, OUT, B> Action <B> (Proxy<RT, Void, Unit, Unit, OUT, B> 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<Void, Proxy<RT, UOutA, AUInA, Void, Unit, 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<Void, Proxy<RT, UOutA, AUInA, Unit, OUT, Unit>> 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, Void, Unit, 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, Void, Unit, DInC, DOutC, A> ReplaceRespond <DInC, DOutC> ( Func<OUT, Proxy<RT, Void, Unit, 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, Unit, Void, A> Reflect () Source #

Reverse the arrows of the Proxy to find its dual.

Parameters

returns

The dual of this

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

method Producer<RT, 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 Producer<RT, 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 Producer<RT, OUT, B> SelectMany <B> (Func<A, Producer<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 Producer<RT, OUT, C> SelectMany <B, C> (Func<A, Producer<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

Operators

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

Compose a Producer and a Consumer together into an Effect.

Parameters

param p1

Producer

param p2

Consumer

returns

Effect

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

Compose a Producer and a Consumer together into an Effect.

Parameters

param p1

Producer

param p2

Consumer

returns

Effect

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

Chain one producer's set of yields after another

class Producer Source #

Producers can only yield

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

Methods

method Producer<RT, OUT, R> Pure <RT, OUT, R> (R value) Source #

where RT : struct, HasCancel<RT>

Monad return / pure

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

where RT : struct, HasCancel<RT>

Send a value downstream (whilst in a producer)

This is the simpler version (fewer generic arguments required) of yield that works for producers.

method Producer<RT, X, Unit> yieldAll <RT, X> (IEnumerable<X> xs) Source #

where RT : struct, HasCancel<RT>

method Producer<RT, X, Unit> yieldAll <RT, X> (IAsyncEnumerable<X> xs) Source #

where RT : struct, HasCancel<RT>

method Producer<RT, X, Unit> yieldAll <RT, X> (IObservable<X> xs) Source #

where RT : struct, HasCancel<RT>

method Producer<RT, A, Unit> repeatM <RT, A> (Aff<RT, A> ma) Source #

where RT : struct, HasCancel<RT>

Repeat a monadic action indefinitely, yielding each result

method Producer<RT, A, Unit> repeatM <RT, A> (Eff<RT, A> ma) Source #

where RT : struct, HasCancel<RT>

Repeat a monadic action indefinitely, yielding each result

method Producer<RT, A, Unit> repeatM <RT, A> (Aff<A> ma) Source #

where RT : struct, HasCancel<RT>

Repeat a monadic action indefinitely, yielding each result

method Producer<RT, A, Unit> repeatM <RT, A> (Eff<A> ma) Source #

where RT : struct, HasCancel<RT>

Repeat a monadic action indefinitely, yielding each result

method Producer<RT, OUT, R> lift <RT, OUT, R> (Eff<R> ma) Source #

where RT : struct, HasCancel<RT>

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

method Producer<RT, OUT, R> lift <RT, OUT, R> (Aff<R> ma) Source #

where RT : struct, HasCancel<RT>

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

method Producer<RT, OUT, R> lift <RT, OUT, R> (Eff<RT, R> ma) Source #

where RT : struct, HasCancel<RT>

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

method Producer<RT, OUT, R> lift <RT, OUT, R> (Aff<RT, R> ma) Source #

where RT : struct, HasCancel<RT>

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

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

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

Lift am IO monad into the Proxy monad transformer

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

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

Lift am IO monad into the Proxy monad transformer

method Producer<RT, OUT, R> use <RT, 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 Producer<RT, OUT, R> use <RT, 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 Producer<RT, OUT, R> use <RT, 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 Producer<RT, OUT, R> use <RT, 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 Producer<RT, OUT, R> use <RT, 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 Producer<RT, OUT, R> use <RT, 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 Producer<RT, OUT, Unit> release <RT, OUT, R> (R dispose) Source #

where RT : struct, HasCancel<RT>

Release a previously used resource

method Producer<RT, S, Unit> FoldUntil <RT, S, A> (this Producer<RT, S, A> ma, S Initial, Func<S, A, S> Fold, Func<A, 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 Producer<RT, S, Unit> FoldWhile <RT, S, A> (this Producer<RT, S, A> ma, S Initial, Func<S, A, S> Fold, Func<A, bool> WhileValue) 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 Producer<RT, S, Unit> FoldUntil <RT, S, A> (this Producer<RT, S, A> ma, S Initial, Func<S, A, S> Fold, Func<S, 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 UntilValue

Predicate

returns

A pipe that folds

method Producer<RT, S, Unit> FoldWhile <RT, S, A> (this Producer<RT, S, A> ma, S Initial, Func<S, A, S> Fold, Func<S, bool> WhileState) 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 Producer<RT, OUT, Unit> merge <RT, OUT> (Seq<Producer<RT, OUT, Unit>> ms) Source #

where RT : struct, HasCancel<RT>

Merge a sequence of producers into a single producer

The merged producer completes when all component producers have completed

Parameters

param ms

Sequence of producers to merge

returns

Merged producers

method Producer<RT, OUT, Unit> merge <RT, OUT> (params Queue<RT, OUT, Unit>[] ms) Source #

where RT : struct, HasCancel<RT>

Merge an array of queues into a single producer

The merged producer completes when all component queues have completed

Parameters

param ms

Sequence of queues to merge

returns

Queues merged into a single producer

method Producer<RT, OUT, Unit> merge <RT, OUT> (params Producer<RT, OUT, Unit>[] ms) Source #

where RT : struct, HasCancel<RT>

Merge an array of producers into a single producer

The merged producer completes when all component producers have completed

Parameters

param ms

Sequence of producers to merge

returns

Merged producers

method Producer<RT, OUT, Unit> merge <RT, OUT> (params Proxy<RT, Void, Unit, Unit, OUT, Unit>[] ms) Source #

where RT : struct, HasCancel<RT>

Merge an array of producers into a single producer

The merged producer completes when all component producers have completed

Parameters

param ms

Sequence of producers to merge

returns

Merged producers

method Producer<RT, OUT, Unit> merge <RT, OUT> (Seq<Queue<RT, OUT, Unit>> ms) Source #

where RT : struct, HasCancel<RT>

Merge a sequence of queues into a single producer

The merged producer completes when all component queues have completed

Parameters

param ms

Sequence of queues to merge

returns

Queues merged into a single producer

method Producer<RT, OUT, Unit> merge <RT, OUT> (Seq<Proxy<RT, Void, Unit, Unit, OUT, Unit>> ms) Source #

where RT : struct, HasCancel<RT>

Merge a sequence of producers into a single producer

The merged producer completes when all component producers have completed

Parameters

param ms

Sequence of producers to merge

returns

Merged producers