LanguageExt.Streaming

LanguageExt.Streaming Transducers TransducerM

Contents

Sub modules

DSL

class TransduceFromM <M, IN> Source #

Methods

method K<TransduceFromM<M, IN>, A> Asks <A> (Func<IN, A> f) Source #

method K<TransduceFromM<M, IN>, A> Local <A> (Func<IN, IN> f, K<TransduceFromM<M, IN>, A> ma) Source #

record TransducerM <M, A, B> Source #

Methods

method ReducerM<M, A, S> Reduce <S> (ReducerM<M, B, S> reducer) Source #

Fold the input stream using the supplied reducer.

Parameters

type S

State

param reducer

Reducer that folds the stream of values flowing through the transducer

returns

method TransducerM<M, A, C> Compose <C> (TransducerM<M, B, C> tg) Source #

Compose two transducers together. The output of the first transducer is the input to the second.

method TransducerM<M, A, C> Map <C> (Func<B, C> f) Source #

Functor map

method TransducerM<M, X, B> Comap <X> (Func<X, A> f) Source #

Contravariant functor map

method TransducerM<M, A, C> Bind <C> (Func<B, K<TransduceFromM<M, A>, C>> f) Source #

Monadic bind

method TransducerM<M, A, C> Bind <C> (Func<B, TransducerM<M, A, C>> f) Source #

Monadic bind

method TransducerM<M, A, D> SelectMany <C, D> (Func<B, K<TransduceFromM<M, A>, C>> bind, Func<B, C, D> project) Source #

Monadic bind

method TransducerM<M, A, D> SelectMany <C, D> (Func<B, TransducerM<M, A, C>> bind, Func<B, C, D> project) Source #

Monadic bind

class TransducerMExtensions Source #

Methods

method TransducerM<M, A, B> As <M, A, B> (this K<TransduceFromM<M, A>, B> ma) Source #

Downcast operator

method TransducerM<M, A, B> As <M, A, B> (this K<TransduceToM<M, B>, A> ma) Source #

Downcast operator

method TransducerM<M, A, B> Filter <M, A, B> (this TransducerM<M, A, B> tab, Func<B, bool> f) Source #

where M : Applicative<M>

Filter values flowing through the transducer.

method TransducerM<M, A, B> Where <M, A, B> (this TransducerM<M, A, B> tab, Func<B, bool> f) Source #

where M : Applicative<M>

Filter values flowing through the transducer.

method TransducerM<M, A, B> Take <M, A, B> (this TransducerM<M, A, B> tab, int n) Source #

where M : Applicative<M>

Take the first n values from the stream.

method TransducerM<M, A, B> Skip <M, A, B> (this TransducerM<M, A, B> tab, int n) Source #

where M : Applicative<M>

Skip the first n values from the stream.

method TransducerM<M, A, S> FoldWhile <M, A, B, S> ( this TransducerM<M, A, B> tab, Func<S, B, S> Folder, Func<S, B, bool> Pred, S State) Source #

where M : Applicative<M>

method TransducerM<M, A, S> FoldWhile <M, A, B, S> ( this TransducerM<M, A, B> tab, Schedule Schedule, Func<S, B, S> Folder, Func<S, B, bool> Pred, S State) Source #

where M : Applicative<M>

method TransducerM<M, A, S> FoldUntil <M, A, B, S> ( this TransducerM<M, A, B> tab, Func<S, B, S> Folder, Func<S, B, bool> Pred, S State) Source #

where M : Applicative<M>

method TransducerM<M, A, S> FoldUntil <M, A, B, S> ( this TransducerM<M, A, B> tab, Schedule Schedule, Func<S, B, S> Folder, Func<S, B, bool> Pred, S State) Source #

where M : Applicative<M>

class TransducerM Source #

Methods

method TransducerM<M, A, A> identity <M, A> () Source #

Identity transducer. Has no effect on values flowing through.

Parameters

type A

Bound value type

returns

Identity transducer

method TransducerM<M, A, B> constant <M, A, B> (B value) Source #

Constant transducer. Ignores all incoming values and yields the constant value.

Parameters

type B

Constant value type

returns

Constant transducer

method TransducerM<M, A, C> compose <M, A, B, C> ( TransducerM<M, A, B> ta, TransducerM<M, B, C> tb) Source #

Compose transducers together. The output of each transducer is fed into the next transducer.

Parameters

param ta

First transducer

param tb

Second transducer

returns

Composed transducer

method TransducerM<M, A, D> compose <M, A, B, C, D> ( TransducerM<M, A, B> ta, TransducerM<M, B, C> tb, TransducerM<M, C, D> tc) Source #

Compose transducers together. The output of each transducer is fed into the next transducer.

Parameters

param ta

First transducer

param tb

Second transducer

param tc

Third transducer

returns

Composed transducer

method TransducerM<M, A, E> compose <M, A, B, C, D, E> ( TransducerM<M, A, B> ta, TransducerM<M, B, C> tb, TransducerM<M, C, D> tc, TransducerM<M, D, E> td) Source #

Compose transducers together. The output of each transducer is fed into the next transducer.

Parameters

param ta

First transducer

param tb

Second transducer

param tc

Third transducer

param td

Fourth transducer

returns

Composed transducer

method TransducerM<M, A, F> compose <M, A, B, C, D, E, F> ( TransducerM<M, A, B> ta, TransducerM<M, B, C> tb, TransducerM<M, C, D> tc, TransducerM<M, D, E> td, TransducerM<M, E, F> te) Source #

Compose transducers together. The output of each transducer is fed into the next transducer.

Parameters

param ta

First transducer

param tb

Second transducer

param tc

Third transducer

param td

Fourth transducer

param te

Fifth transducer

returns

Composed transducer

method TransducerM<M, A, G> compose <M, A, B, C, D, E, F, G> ( TransducerM<M, A, B> ta, TransducerM<M, B, C> tb, TransducerM<M, C, D> tc, TransducerM<M, D, E> td, TransducerM<M, E, F> te, TransducerM<M, F, G> tf) Source #

Compose transducers together. The output of each transducer is fed into the next transducer.

Parameters

param ta

First transducer

param tb

Second transducer

param tc

Third transducer

param td

Fourth transducer

param te

Fifth transducer

param tf

Sixth transducer

returns

Composed transducer

method TransducerM<M, A, A> skip <M, A> (int amount) Source #

where M : Applicative<M>

Skip amount items in the sequence before yielding

Parameters

type A

Value type

param amount

Number of items to skip

returns

Transducer that skips values

method TransducerM<M, A, A> take <M, A> (int amount) Source #

where M : Applicative<M>

Take amount items in the sequence before terminating

Parameters

type A

Value type

param amount

Number of items to take

returns

Transducer that takes amount values only

method TransducerM<M, A, B> map <M, A, B> (Func<A, B> f) Source #

Functor map transducer

Parameters

type A

Input value type

type B

Output value type

param f

Function to map values of type A to values of type B

returns

Mapping transducer

method TransducerM<M, A, A> filter <M, A> (Func<A, bool> predicate) Source #

where M : Applicative<M>

Applicative filter transducer

Parameters

type A

Bound value type

param predicate

Filters each value flowing through the transducer. If true the value will flow downstream; if false, the value is dropped

returns

Filtering transducer

method TransducerM<M, Env, B> bind <M, Env, A, B> (TransducerM<M, Env, A> ta, Func<A, K<TransduceFromM<M, Env>, B>> f) Source #

Monad bind transducer

Chains two transducers together

Parameters

type Env

Input value type

type A

Result value type of the first transducer

type B

Result value type of returned transducer

param ta

Initial transducer to run

param f

Chaining function to run with the result of ta that will produce a new Transducer

returns

A monadic bind transducer operation

method TransducerM<M, Env, B> bind <M, Env, A, B> (TransducerM<M, Env, A> ta, Func<A, TransducerM<M, Env, B>> f) Source #

Monad bind transducer

Chains two transducers together

Parameters

type Env

Input value type

type A

Result value type of the first transducer

type B

Result value type of returned transducer

param ta

Initial transducer to run

param f

Chaining function to run with the result of ta that will produce a new Transducer

returns

A monadic bind transducer operation

method TransducerM<M, A, S> foldWhile <M, A, S> ( Func<S, A, S> Folder, Func<S, A, bool> Pred, S State) Source #

where M : Applicative<M>

Fold items in the stream while the predicate returns true; once the predicate returns false, the aggregated value is yielded downstream.

Parameters

type A

Bound value type

type S

Yielded aggregate value type

param Folder

Aggregating binary fold function

param Pred

Predicate

param State

Initial state

returns

Aggregating binary folding transducer

method TransducerM<M, A, S> foldWhile <M, A, S> ( Schedule Schedule, Func<S, A, S> Folder, Func<S, A, bool> Pred, S State) Source #

where M : Applicative<M>

Fold items in the stream while the predicate returns true; once the predicate returns false, the aggregated value is yielded downstream.

Parameters

type A

Bound value type

type S

Yielded aggregate value type

param Schedule

Schedule for each yielded item

param Folder

Aggregating binary fold function

param Pred

Predicate

param State

Initial state

returns

Aggregating binary folding transducer

method TransducerM<M, A, S> foldUntil <M, A, S> ( Func<S, A, S> Folder, Func<S, A, bool> Pred, S State) Source #

where M : Applicative<M>

Fold items in the stream until the predicate returns true; once the predicate returns true, the aggregated value is yielded downstream.

Parameters

type A

Bound value type

type S

Yielded aggregate value type

param Folder

Aggregating binary fold function

param Pred

Predicate

param State

Initial state

returns

Aggregating binary folding transducer

method TransducerM<M, A, S> foldUntil <M, A, S> ( Schedule Schedule, Func<S, A, S> Folder, Func<S, A, bool> Pred, S State) Source #

where M : Applicative<M>

Fold items in the stream until the predicate returns true; once the predicate returns true, the aggregated value is yielded downstream.

Parameters

type A

Bound value type

type S

Yielded aggregate value type

param Schedule

Schedule for each yielded item

param Folder

Aggregating binary fold function

param Pred

Predicate

param State

Initial state

returns

Aggregating binary folding transducer

class TransduceToM <M, OUT> Source #