LanguageExt.Core

LanguageExt.Core Monads Alternative Monads EitherT

Contents

Sub modules

Extensions
Operators
Trait

record EitherT <L, M, R> (K<M, Either<L, R>> runEither) Source #

where M : Monad<M>

EitherT monad transformer, which allows for either an L or R result value to be carried.

Parameters

type M

Given monad trait

type L

Left value type

type R

Bound value type

Properties

property K<M, bool> IsRight Source #

Is the EitherT in a Right state?

property K<M, bool> IsLeft Source #

Is the EitherT in a Left state?

Methods

method K<M, B> Match <B> (Func<L, B> Left, Func<R, B> Right) Source #

Invokes the Right or Left function depending on the state of the Either

Parameters

type B

Return type

param Left

Function to invoke if in a Left state

param Right

Function to invoke if in a Right state

returns

The return value of the invoked function

method K<M, Unit> Match (Action<L> Left, Action<R> Right) Source #

Invokes the Right or Left action depending on the state of the Either

Parameters

param Right

Action to invoke if in a Right state

param Left

Action to invoke if in a Left state

returns

Unit

method K<M, R> IfLeft (Func<R> Left) Source #

Executes the Left function if the Either is in a Left state. Returns the Right value if the Either is in a Right state.

Parameters

param Left

Function to generate a Right value if in the Left state

returns

Returns an unwrapped Right value

method K<M, R> IfLeft (Func<L, R> leftMap) Source #

Executes the leftMap function if the Either is in a Left state. Returns the Right value if the Either is in a Right state.

Parameters

param leftMap

Function to generate a Right value if in the Left state

returns

Returns an unwrapped Right value

method K<M, R> IfLeft (R rightValue) Source #

Returns the rightValue if the Either is in a Left state. Returns the Right value if the Either is in a Right state.

Parameters

param rightValue

Value to return if in the Left state

returns

Returns an unwrapped Right value

method K<M, Unit> IfLeft (Action<L> Left) Source #

Executes the Left action if the Either is in a Left state.

Parameters

param Left

Function to generate a Right value if in the Left state

returns

Returns an unwrapped Right value

method K<M, Unit> IfRight (Action<R> Right) Source #

Invokes the Right action if the Either is in a Right state, otherwise does nothing

Parameters

param Right

Action to invoke

returns

Unit

method K<M, L> IfRight (L leftValue) Source #

Returns the leftValue if the Either is in a Right state. Returns the Left value if the Either is in a Left state.

Parameters

param leftValue

Value to return if in the Left state

returns

Returns an unwrapped Left value

method K<M, L> IfRight (Func<L> Right) Source #

Returns the result of Right() if the Either is in a Right state. Returns the Left value if the Either is in a Left state.

Parameters

param Right

Function to generate a Left value if in the Right state

returns

Returns an unwrapped Left value

method K<M, L> IfRight (Func<R, L> rightMap) Source #

Returns the result of rightMap if the Either is in a Right state. Returns the Left value if the Either is in a Left state.

Parameters

param rightMap

Function to generate a Left value if in the Right state

returns

Returns an unwrapped Left value

method EitherT<L, M1, B> MapT <M1, B> (Func<K<M, Either<L, R>>, K<M1, Either<L, B>>> f) Source #

where M1 : Monad<M1>

Maps the bound monad

Parameters

type M1

Target monad type

type B

Target bound value type

param f

Mapping function

returns

Mapped monad

method EitherT<L, M, B> MapM <B> (Func<K<M, R>, K<M, B>> f) Source #

Maps the given monad

Parameters

param f

Mapping function

method EitherT<L, M, B> Map <B> (Func<R, B> f) Source #

Maps the bound value

Parameters

type B

Target bound value type

param f

Mapping function

returns

Mapped structure

method EitherT<L, M, B> Select <B> (Func<R, B> f) Source #

Maps the bound value

Parameters

type B

Target bound value type

param f

Mapping transducer

returns

Mapped structure

method EitherT<B, M, R> MapLeft <B> (Func<L, B> f) Source #

Maps the left value

Parameters

type B

Target bound value type

param f

Mapping function

returns

Mapped structure

method EitherT<L1, M, R1> BiMap <L1, R1> ( Func<L, L1> Left, Func<R, R1> Right) Source #

Bifunctor map operation

Parameters

type L1

Target left type

type R1

Target right type

param Left

Left map function

param Right

Right map function

returns

Mapped structure

method EitherT<L, M, B> Bind <B> (Func<R, K<EitherT<L, M>, B>> f) Source #

Monad bind operation

Parameters

type B

Target bound value type

param f

Mapping function

returns

EitherT

method EitherT<L, M, B> Bind <B> (Func<R, Either<L, B>> f) Source #

Monad bind operation

Parameters

type B

Target bound value type

param f

Mapping function

returns

EitherT

method EitherT<L, M, B> Bind <B> (Func<R, EitherT<L, M, B>> f) Source #

Monad bind operation

Parameters

type B

Target bound value type

param f

Mapping function

returns

EitherT

method EitherT<L, M, B> Bind <B> (Func<R, Pure<B>> f) Source #

Monad bind operation

Parameters

type B

Target bound value type

param f

Mapping function

returns

EitherT

method EitherT<L, M, B> Bind <B> (Func<R, Fail<L>> f) Source #

Monad bind operation

Parameters

type B

Target bound value type

param f

Mapping function

returns

EitherT

method EitherT<L1, M, R> BindLeft <L1> (Func<L, K<EitherT<M>, L1, R>> f) Source #

Bimonad bind left

Parameters

type L1
param f
returns

method EitherT<L, M, R1> BindRight <R1> (Func<R, K<EitherT<M>, L, R1>> f) Source #

Bimonad bind right

Parameters

type L1
param f
returns

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

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 <B, C> (Func<R, EitherT<L, M, B>> bind, Func<R, B, C> project) Source #

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 <B, C> (Func<R, K<M, B>> bind, Func<R, B, C> project) Source #

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 <B, C> (Func<R, Either<L, B>> bind, Func<R, B, C> project) Source #

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 <B, C> (Func<R, Pure<B>> bind, Func<R, B, C> project) Source #

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 <B, C> (Func<R, IO<B>> bind, Func<R, B, C> project) Source #

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 <C> (Func<R, Guard<L, Unit>> bind, Func<R, Unit, C> project) Source #

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 OptionT<M, R> ToOption () Source #

class EitherT Source #

Methods

method EitherT<L, M, A> Right <L, M, A> (A value) Source #

where M : Monad<M>

Lift a pure value into the monad-transformer

Parameters

param value

Value to lift

returns

EitherT

method EitherT<L, M, A> Left <L, M, A> (L value) Source #

where M : Monad<M>

Lift a fail value into the monad-transformer

Parameters

param value

Value to lift

returns

EitherT

method EitherT<L, M, A> lift <L, M, A> (Either<L, A> value) Source #

where M : Monad<M>

Lifts a given Either value into the transformer

Parameters

param value

Value to lift

returns

EitherT

method EitherT<L, M, A> lift <L, M, A> (K<M, A> ma) Source #

where M : Monad<M>

Lifts a given monad into the transformer

Parameters

param ma

Monad to lift

returns

EitherT

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

where M : Monad<M>

Lifts a given monad into the transformer

Parameters

param ma

Monad to lift

returns

EitherT

method EitherT<L, M, A> lift <L, M, A> (Pure<A> ma) Source #

where M : Monad<M>

Lifts a given value into the transformer

Parameters

param pure

Value to lift

returns

EitherT

method EitherT<L, M, A> lift <L, M, A> (Fail<L> ma) Source #

where M : Monad<M>

Lifts a given value into the transformer

Parameters

param fail

Value to lift

returns

EitherT

method EitherT<L, M, A> liftIO <L, M, A> (K<IO, A> ma) Source #

where M : MonadIO<M>

Lifts a given monad into the transformer

Parameters

param ma

Monad to lift

returns

EitherT

method EitherT<L, M, A> liftIO <L, M, A> (IO<Either<L, A>> ma) Source #

where M : MonadIO<M>

Lifts a given monad into the transformer

Parameters

param ma

Monad to lift

returns

EitherT