LanguageExt.Core

LanguageExt.Core Monads Alternative Monads EitherT Extensions

Contents

class EitherTExtensions Source #

Methods

method EitherT<L, M, B> Action <L, M, A, B> (this EitherT<L, M, A> ma, K<EitherT<L, M>, B> mb) Source #

where M : Monad<M>

Applicative action: runs the first applicative, ignores the result, and returns the second applicative

method EitherT<L, M, B> Action <L, M, A, B> (this K<EitherT<L, M>, A> ma, K<EitherT<L, M>, B> mb) Source #

where M : Monad<M>

Applicative action: runs the first applicative, ignores the result, and returns the second applicative

method EitherT<L, M, B> Apply <L, M, A, B> (this EitherT<L, M, Func<A, B>> mf, K<EitherT<L, M>, A> ma) Source #

where M : Monad<M>

Applicative functor apply operation

Unwraps the value within the ma applicative-functor, passes it to the unwrapped function(s) within mf, and then takes the resulting value and wraps it back up into a new applicative-functor.

Parameters

param ma

Value(s) applicative functor

param mf

Mapping function(s)

returns

Mapped applicative functor

method EitherT<L, M, B> Apply <L, M, A, B> (this K<EitherT<L, M>, Func<A, B>> mf, K<EitherT<L, M>, A> ma) Source #

where M : Monad<M>

Applicative functor apply operation

Unwraps the value within the ma applicative-functor, passes it to the unwrapped function(s) within mf, and then takes the resulting value and wraps it back up into a new applicative-functor.

Parameters

param ma

Value(s) applicative functor

param mf

Mapping function(s)

returns

Mapped applicative functor

class EitherTExtensions Source #

EitherT monad-transformer extensions

Methods

method EitherT<L, M, R> As <L, M, R> (this K<EitherT<L, M>, R> ma) Source #

where M : Monad<M>

method EitherT<L, M, R> As2 <L, M, R> (this K<EitherT<M>, L, R> ma) Source #

where M : Monad<M>

method FinT<M, R> ToFin <M, R> (this K<EitherT<Error, M>, R> ma) Source #

where M : Monad<M>

method K<M, Either<L, A>> Run <L, M, A> (this K<EitherT<L, M>, A> ma) Source #

where M : Monad<M>

Runs the EitherT exposing the outer monad with an inner wrapped Either

method EitherT<L, M, B> Bind <L, M, A, B> (this K<EitherT<L, M>, A> ma, Func<A, IO<B>> f) Source #

where M : MonadIO<M>

Monad bind operation

Parameters

type B

Target bound value type

param f

Mapping function

returns

EitherT

method EitherT<L, IO, A> Flatten <L, A> (this Task<EitherT<L, IO, A>> tma) Source #

Get the outer task and wrap it up in a new IO within the EitherT IO

method EitherT<L, IO, A> ToIO <L, A> (this Task<Either<L, A>> ma) Source #

Lift the task

method EitherT<L, M, A> Flatten <L, M, A> (this EitherT<L, M, EitherT<L, M, A>> mma) Source #

where M : Monad<M>

Monadic join

method EitherT<L, M, A> Where <L, M, A> (this K<EitherT<L, M>, A> ma, Func<A, bool> pred) Source #

where L : Monoid<L>
where M : Monad<M>

Filtering based on predicate.

If the predicate returns false, then Left(L.Empty) is yielded and therefore L must be a monoid.

method EitherT<L, M, A> Filter <L, M, A> (this K<EitherT<L, M>, A> ma, Func<A, bool> pred) Source #

where L : Monoid<L>
where M : Monad<M>

Filtering based on predicate.

If the predicate returns false, then Left(L.Empty) is yielded and therefore L must be a monoid.

method EitherT<L, M, C> SelectMany <L, M, A, B, C> ( this K<M, A> ma, Func<A, K<EitherT<L, M>, B>> bind, Func<A, B, C> project) Source #

where M : Monad<M>

Monad bind operation

Parameters

type B

Intermediate bound value type

type C

Target bound value type

param bind

Monadic bind function

param project

Projection function

returns

EitherT

method EitherT<L, M, C> SelectMany <L, M, A, B, C> ( this K<M, A> ma, Func<A, EitherT<L, M, B>> bind, Func<A, B, C> project) Source #

where M : Monad<M>

Monad bind operation

Parameters

type B

Intermediate bound value type

type C

Target bound value type

param bind

Monadic bind function

param project

Projection function

returns

EitherT

method K<M, (Seq<L> Lefts, Seq<R> Rights)> Partition <F, L, M, R> (this K<F, EitherT<L, M, R>> self) Source #

where F : Foldable<F>
where M : Monad<M>

Partitions a foldable of EitherT into two sequences.

All the Left elements are extracted, in order, to the first component of the output. Similarly, the Right elements are extracted to the second component of the output.

Parameters

returns

A pair containing the sequences of partitioned values

method K<M, Seq<L>> Lefts <F, L, M, R> (this K<F, EitherT<L, M, R>> self) Source #

where F : Foldable<F>
where M : Monad<M>

Partitions a foldable of EitherT into two lists and returns the Left items only.

Parameters

returns

A sequence of partitioned items

method K<M, Seq<R>> Rights <F, L, M, R> (this K<F, EitherT<L, M, R>> self) Source #

where F : Foldable<F>
where M : Monad<M>

Partitions a foldable of EitherT into two lists and returns the Right items only.

Parameters

returns

A sequence of partitioned items

class EitherTExtensions Source #

Methods

method EitherT<L, M, B> Map <L, M, A, B> (this Func<A, B> f, K<EitherT<L, M>, A> ma) Source #

where M : Monad<M>

Functor map operation

Unwraps the value within the functor, passes it to the map function f provided, and then takes the mapped value and wraps it back up into a new functor.

Parameters

param ma

Functor to map

param f

Mapping function

returns

Mapped functor

method EitherT<L, M, B> Map <L, M, A, B> (this Func<A, B> f, EitherT<L, M, A> ma) Source #

where M : Monad<M>

Functor map operation

Unwraps the value within the functor, passes it to the map function f provided, and then takes the mapped value and wraps it back up into a new functor.

Parameters

param ma

Functor to map

param f

Mapping function

returns

Mapped functor

class EitherTGuardExtensions Source #

Methods

method EitherT<L, M, Unit> ToEitherT <L, M> (this Guard<L, Unit> guard) Source #

where M : Monad<M>

Natural transformation to EitherT

method EitherT<L, M, B> Bind <L, M, B> ( this Guard<L, Unit> guard, Func<Unit, EitherT<L, M, B>> f) Source #

where M : Monad<M>

Monadic binding support for EitherT

method EitherT<L, M, C> SelectMany <L, M, B, C> ( this Guard<L, Unit> guard, Func<Unit, EitherT<L, M, B>> bind, Func<Unit, B, C> project) Source #

where M : Monad<M>

Monadic binding support for EitherT