LanguageExt.Streaming

LanguageExt.Streaming Transducers Transducer

Contents

Sub modules

DSL

class TransduceFrom <IN> Source #

Methods

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

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

record Transducer <A, B> Source #

Methods

method ReducerAsync<A, S> Reduce <S> (ReducerAsync<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 Transducer<A, C> Compose <C> (Transducer<B, C> tg) Source #

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

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

Functor map

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

Contravariant functor map

method Transducer<A, C> Bind <C> (Func<B, K<TransduceFrom<A>, C>> f) Source #

Monadic bind

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

Monadic bind

method Transducer<A, D> SelectMany <C, D> (Func<B, K<TransduceFrom<A>, C>> bind, Func<B, C, D> project) Source #

Monadic bind

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

Monadic bind

method Transducer<A, B> Filter (Func<B, bool> f) Source #

Filter values flowing through the transducer.

method Transducer<A, B> Where (Func<B, bool> f) Source #

Filter values flowing through the transducer.

method Transducer<A, B> Take (int n) Source #

Take the first n values from the stream.

method Transducer<A, B> Skip (int n) Source #

Skip the first n values from the stream.

method Transducer<A, S> FoldWhile <S> ( Func<S, B, S> Folder, Func<S, B, bool> Pred, S State) Source #

method Transducer<A, S> FoldWhile <S> ( Schedule Schedule, Func<S, B, S> Folder, Func<S, B, bool> Pred, S State) Source #

method Transducer<A, S> FoldUntil <S> ( Func<S, B, S> Folder, Func<S, B, bool> Pred, S State) Source #

method Transducer<A, S> FoldUntil <S> ( Schedule Schedule, Func<S, B, S> Folder, Func<S, B, bool> Pred, S State) Source #

class TransducerExtensions Source #

Methods

method Transducer<A, B> As <A, B> (this K<TransduceFrom<A>, B> ma) Source #

Downcast operator

method Transducer<A, B> As <A, B> (this K<TransduceTo<B>, A> ma) Source #

Downcast operator

class Transducer Source #

Methods

method Transducer<A, A> identity <A> () Source #

Identity transducer. Has no effect on values flowing through.

Parameters

type A

Bound value type

returns

Identity transducer

method Transducer<A, B> constant <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 Transducer<A, C> compose <A, B, C> ( Transducer<A, B> ta, Transducer<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 Transducer<A, D> compose <A, B, C, D> ( Transducer<A, B> ta, Transducer<B, C> tb, Transducer<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 Transducer<A, E> compose <A, B, C, D, E> ( Transducer<A, B> ta, Transducer<B, C> tb, Transducer<C, D> tc, Transducer<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 Transducer<A, F> compose <A, B, C, D, E, F> ( Transducer<A, B> ta, Transducer<B, C> tb, Transducer<C, D> tc, Transducer<D, E> td, Transducer<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 Transducer<A, G> compose <A, B, C, D, E, F, G> ( Transducer<A, B> ta, Transducer<B, C> tb, Transducer<C, D> tc, Transducer<D, E> td, Transducer<E, F> te, Transducer<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 Transducer<A, A> skip <A> (int amount) Source #

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 Transducer<A, A> take <A> (int amount) Source #

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 Transducer<A, B> map <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 Transducer<A, A> filter <A> (Func<A, bool> predicate) Source #

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 Transducer<Env, B> bind <Env, A, B> (Transducer<Env, A> ta, Func<A, K<TransduceFrom<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 Transducer<Env, B> bind <Env, A, B> (Transducer<Env, A> ta, Func<A, Transducer<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 Transducer<A, S> foldWhile <A, S> ( Func<S, A, S> Folder, Func<S, A, bool> Pred, S State) Source #

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 Transducer<A, S> foldWhile <A, S> ( Schedule Schedule, Func<S, A, S> Folder, Func<S, A, bool> Pred, S State) Source #

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 Transducer<A, S> foldUntil <A, S> ( Func<S, A, S> Folder, Func<S, A, bool> Pred, S State) Source #

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 Transducer<A, S> foldUntil <A, S> ( Schedule Schedule, Func<S, A, S> Folder, Func<S, A, bool> Pred, S State) Source #

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 TransduceTo <OUT> Source #