LanguageExt.Core

LanguageExt.Core Monads Alternative Monads ValidationT

Contents

record ValidationT <F, M, A> (K<M, Validation<F, A>> runValidation) Source #

where M : Monad<M>
where F : Monoid<F>

ValidationT monad transformer, which allows for an optional result.

Parameters

type M

Given monad trait

type F

Left value type

type A

Bound value type

param runValidation

Transducer that represents the transformer operation

Methods

method ValidationT<F, M, A> Success (A value) Source #

Lift a pure value into the monad-transformer

Parameters

param value

Value to lift

returns

ValidationT

method ValidationT<F, M, A> Fail (F value) Source #

Lift a fail value into the monad-transformer

Parameters

param value

Value to lift

returns

ValidationT

method ValidationT<F, M, A> Lift (Pure<A> pure) Source #

Lifts a given monad into the transformer

Parameters

param pure

Monad to lift

returns

ValidationT

method ValidationT<F, M, A> Lift (Validation<F, A> Validation) Source #

Lifts a given monad into the transformer

Parameters

param Validation

Monad to lift

returns

ValidationT

method ValidationT<F, M, A> Lift (Fail<F> fail) Source #

Lifts a given monad into the transformer

Parameters

param fail

Monad to lift

returns

ValidationT

method ValidationT<F, M, A> Lift (K<M, A> monad) Source #

Lifts a given monad into the transformer

Parameters

param monad

Monad to lift

returns

ValidationT

method ValidationT<F, M, A> LiftIO (IO<A> monad) Source #

Lifts a given monad into the transformer

Parameters

param monad

Monad to lift

returns

ValidationT

method K<M, B> Match <B> (Func<A, B> Succ, Func<F, B> Fail) Source #

method K<M, Validation<F, A>> Run () Source #

method ValidationT<F, M1, B> MapT <M1, B> (Func<K<M, Validation<F, A>>, K<M1, Validation<F, 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 ValidationT<F, M, B> MapM <B> (Func<K<M, A>, K<M, B>> f) Source #

Maps the given monad

Parameters

param f

Mapping function

method ValidationT<F, M, B> Map <B> (Func<A, B> f) Source #

Maps the bound value

Parameters

type B

Target bound value type

param f

Mapping function

returns

ValidationT

method ValidationT<F, M, B> Select <B> (Func<A, B> f) Source #

Maps the bound value

Parameters

type B

Target bound value type

param f

Mapping transducer

returns

ValidationT

method ValidationT<F, M, B> Bind <B> (Func<A, K<ValidationT<F, M>, B>> f) Source #

Monad bind operation

Parameters

type B

Target bound value type

param f

Mapping function

returns

ValidationT

method ValidationT<F, M, B> Bind <B> (Func<A, ValidationT<F, M, B>> f) Source #

Monad bind operation

Parameters

type B

Target bound value type

param f

Mapping function

returns

ValidationT

method ValidationT<F, M, B> BiBind <B> (Func<A, ValidationT<F, M, B>> Succ, Func<F, ValidationT<F, M, B>> Fail) Source #

Monad bind operation

Parameters

type B

Target bound value type

param Succ

Success mapping function

param Fail

Failure mapping function

returns

ValidationT

method ValidationT<F, M, A> BindFail (Func<F, ValidationT<F, M, A>> Fail) Source #

Failure bind operation

Parameters

type B

Target bound value type

param Fail

Failure mapping function

returns

ValidationT

method ValidationT<F, M, B> Bind <B> (Func<A, IO<B>> f) Source #

Monad bind operation

Parameters

type B

Target bound value type

param f

Mapping function

returns

ValidationT

method ValidationT<F, M, B> Bind <B> (Func<A, Pure<B>> f) Source #

Monad bind operation

Parameters

type B

Target bound value type

param f

Mapping function

returns

ValidationT

method ValidationT<F, M, C> SelectMany <B, C> (Func<A, K<ValidationT<F, M>, B>> bind, Func<A, 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

ValidationT

method ValidationT<F, M, C> SelectMany <B, C> (Func<A, ValidationT<F, M, B>> bind, Func<A, 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

ValidationT

method ValidationT<F, M, C> SelectMany <B, C> (Func<A, K<M, B>> bind, Func<A, 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

ValidationT

method ValidationT<F, M, C> SelectMany <B, C> (Func<A, Validation<F, B>> bind, Func<A, 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

ValidationT

method ValidationT<F, M, C> SelectMany <B, C> (Func<A, Pure<B>> bind, Func<A, 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

ValidationT

method ValidationT<F, M, C> SelectMany <B, C> (Func<A, IO<B>> bind, Func<A, 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

ValidationT

method StreamT<M, A> ToStream () Source #

method StreamT<M, F> FailToStream () Source #

Operators

operator >> (ValidationT<F, M, A> lhs, ValidationT<F, M, A> rhs) Source #

Sequentially compose two actions, discarding any value produced by the first, like sequencing operators (such as the semicolon) in C#.

Parameters

param lhs

First action to run

param rhs

Second action to run

returns

Result of the second action

operator >> (ValidationT<F, M, A> lhs, K<ValidationT<F, M>, A> rhs) Source #

Sequentially compose two actions, discarding any value produced by the first, like sequencing operators (such as the semicolon) in C#.

Parameters

param lhs

First action to run

param rhs

Second action to run

returns

Result of the second action

operator >> (ValidationT<F, M, A> lhs, ValidationT<F, M, Unit> rhs) Source #

Sequentially compose two actions. The second action is a unit returning action, so the result of the first action is propagated.

Parameters

param lhs

First action to run

param rhs

Second action to run

returns

Result of the first action

operator >> (ValidationT<F, M, A> lhs, K<ValidationT<F, M>, Unit> rhs) Source #

Sequentially compose two actions. The second action is a unit returning action, so the result of the first action is propagated.

Parameters

param lhs

First action to run

param rhs

Second action to run

returns

Result of the first action

operator | (ValidationT<F, M, A> lhs, ValidationT<F, M, A> rhs) Source #

operator | (K<ValidationT<F, M>, A> lhs, ValidationT<F, M, A> rhs) Source #

operator | (ValidationT<F, M, A> lhs, K<ValidationT<F, M>, A> rhs) Source #

operator | (ValidationT<F, M, A> lhs, Pure<A> rhs) Source #

operator | (ValidationT<F, M, A> lhs, Fail<F> rhs) Source #

operator | (ValidationT<F, M, A> lhs, CatchM<F, ValidationT<F, M>, A> rhs) Source #

operator & (ValidationT<F, M, A> ma, ValidationT<F, M, A> mb) Source #

class ValidationTExtensions Source #

ValidationT monad transformer extensions

Methods

method ValidationT<L, M, A> As <L, M, A> (this K<ValidationT<L, M>, A> ma) Source #

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

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

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

Monadic join

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

where L : Monoid<L>

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

method ValidationT<L, IO, A> ToIO <L, A> (this Task<Validation<L, A>> ma) Source #

where L : Monoid<L>

Lift the task

method OptionT<M, A> ToOption <F, M, A> (this ValidationT<F, M, A> ma) Source #

where F : Monoid<F>
where M : Monad<M>

method EitherT<F, M, A> ToEither <F, M, A> (this ValidationT<F, M, A> ma) Source #

where F : Monoid<F>
where M : Monad<M>

method FinT<M, A> ToFin <M, A> (this ValidationT<Error, M, A> ma) Source #

where M : Monad<M>

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

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

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

ValidationT

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

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

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

ValidationT

class ValidationTExtensions Source #

Methods

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

where F : Monoid<F>
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 ValidationT<F, M, B> Map <F, M, A, B> (this Func<A, B> f, ValidationT<F, M, A> ma) Source #

where F : Monoid<F>
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 ValidationT<F, M, B> Action <F, M, A, B> (this ValidationT<F, M, A> ma, K<ValidationT<F, M>, B> mb) Source #

where F : Monoid<F>
where M : Monad<M>

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

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

where F : Monoid<F>
where M : Monad<M>

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

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

where F : Monoid<F>
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 ValidationT<F, M, B> Apply <F, M, A, B> (this K<ValidationT<F, M>, Func<A, B>> mf, K<ValidationT<F, M>, A> ma) Source #

where F : Monoid<F>
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 ValidationT <F, M> Source #

Methods

method ValidationT<F, M, A> Right <A> (A value) Source #

method ValidationT<F, M, A> Left <A> (F value) Source #

method ValidationT<F, M, A> lift <A> (Validation<F, A> ma) Source #

method ValidationT<F, M, A> lift <A> (Pure<A> ma) Source #

method ValidationT<F, M, A> lift <A> (Fail<F> ma) Source #

method ValidationT<F, M, A> liftIO <A> (IO<A> ma) Source #

class ValidationT Source #

Methods

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

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

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

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

method ValidationT<L, M, A> lift <L, M, A> (Validation<L, A> ma) Source #

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

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

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

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

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

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

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

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

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

method K<M, B> match <L, M, A, B> (ValidationT<L, M, A> ma, Func<A, B> Succ, Func<L, B> Fail) Source #

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

class ValidationT <F, M> Source #

where M : Monad<M>
where F : Monoid<F>

Trait implementation for ValidationT

Parameters

type M

Given monad trait

class Prelude Source #

Methods

method ValidationT<F, M, B> map <F, M, A, B> (Func<A, B> f, K<ValidationT<F, M>, A> ma) Source #

where F : Monoid<F>
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 ValidationT<F, M, B> action <F, M, A, B> (K<ValidationT<F, M>, A> ma, K<ValidationT<F, M>, B> mb) Source #

where F : Monoid<F>
where M : Monad<M>

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

method ValidationT<F, M, B> apply <F, M, A, B> (K<ValidationT<F, M>, Func<A, B>> mf, K<ValidationT<F, M>, A> ma) Source #

where F : Monoid<F>
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