LanguageExt.Core

LanguageExt.Core Monads Alternative Monads Either Extensions

Contents

class EitherExtensions Source #

Methods

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

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

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

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

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

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 Either<L, B> Apply <L, A, B> (this K<Either<L>, Func<A, B>> mf, K<Either<L>, A> ma) Source #

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 EitherExtensions Source #

Extension methods for Either

Methods

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

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

method EitherUnitContext<L, R> Right <L, R> (this K<Either<L>, R> ma, Action<R> right) Source #

Match Right and return a context. You must follow this with .Left(...) to complete the match

Parameters

param right

Action to invoke if the Either is in a Right state

returns

Context that must have Left() called upon it.

method EitherContext<L, R, R2> Right <L, R, R2> (this K<Either<L>, R> ma, Func<R, R2> right) Source #

Match Right and return a context. You must follow this with .Left(...) to complete the match

Parameters

param right

Action to invoke if the Either is in a Right state

returns

Context that must have Left() called upon it.

method Either<L, R> Flatten <L, R> (this K<Either<L>, Either<L, R>> ma) Source #

Monadic join

method Either<L, R> Flatten <L, R> (this K<Either<L>, K<Either<L>, R>> ma) Source #

Monadic join

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

where L : Monoid<L>

Filtering based on predicate.

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

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

where L : Monoid<L>

Filtering based on predicate.

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

method Validation<L, R> ToValidation <L, R> (this Either<L, R> ma) Source #

where L : Monoid<L>

method Eff<R> ToEff <R> (this Either<Error, R> ma) Source #

Convert to an Eff

Parameters

returns

Eff monad

method Eff<R> ToEff <R> (this Either<Exception, R> ma) Source #

Convert to an Eff

Parameters

returns

Eff monad

method Eff<R> ToEff <R> (this Either<string, R> ma) Source #

Convert to an Eff

Parameters

returns

Eff monad

class EitherExtensions Source #

Methods

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

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 Either<L, B> Map <L, A, B> (this Func<A, B> f, Either<L, A> ma) Source #

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 EitherGuardExtensions Source #

Methods

method Either<L, Unit> ToEither <L> (this Guard<L, Unit> guard) Source #

Natural transformation to Either

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

Monadic binding support for Either

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

Monadic binding support for Either