LanguageExt.Core

LanguageExt.Core Monads Alternative Monads TryT

Contents

record TryT <M, A> (K<M, Try<A>> runTry) Source #

where M : Monad<M>

TryT monad transformer, which allows for an optional result.

Parameters

type M

Given monad trait

type A

Bound value type

param runEither

Transducer that represents the transformer operation

Methods

method TryT<M, A> Succ (A value) Source #

Lift a pure value into the monad-transformer

Parameters

param value

Value to lift

returns

TryT

method TryT<M, A> Fail (Error value) Source #

Lift a fail value into the monad-transformer

Parameters

param value

Value to lift

returns

TryT

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

Lifts a given monad into the transformer

Parameters

returns

TryT

method TryT<M, A> Lift (Fin<A> result) Source #

Lifts a given monad into the transformer

Parameters

returns

TryT

method TryT<M, A> Lift (Func<Fin<A>> result) Source #

Lifts a given monad into the transformer

Parameters

returns

TryT

method TryT<M, A> Lift (Fail<Error> fail) Source #

Lifts a given monad into the transformer

Parameters

param fail

Monad to lift

returns

TryT

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

Lifts a given monad into the transformer

Parameters

param monad

Monad to lift

returns

TryT

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

Lifts a given monad into the transformer

Parameters

param monad

Monad to lift

returns

TryT

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

Match the bound value and return a result (which gets packages back up inside the inner monad)

Parameters

param Succ

Success branch

param Fail

Fail branch

returns

Inner monad with the result of the Succ or Fail branches

method K<M, A> IfFail (Func<Error, A> Fail) Source #

Match the bound value and return a result (which gets packages back up inside the inner monad)

Parameters

param Succ

Success branch

param Fail

Fail branch

returns

Inner monad with the result of the Succ or Fail branches

method K<M, A> IfFailM (Func<Error, K<M, A>> Fail) Source #

Match the bound value and return a result (which gets packages back up inside the inner monad)

Parameters

param Succ

Success branch

param Fail

Fail branch

returns

Inner monad with the result of the Succ or Fail branches

method TryT<M1, B> MapT <M1, B> (Func<K<M, Fin<A>>, K<M1, Fin<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 TryT<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

TryT

method TryT<M, A> MapFail (Func<Error, Error> f) Source #

Maps the bound value

Parameters

param f

Mapping function

returns

TryT

method TryT<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

TryT

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

Monad bind operation

Parameters

type B

Target bound value type

param f

Mapping function

returns

TryT

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

Monad bind operation

Parameters

type B

Target bound value type

param f

Mapping function

returns

TryT

method TryT<M, B> BiBind <B> (Func<A, TryT<M, B>> Succ, Func<Error, TryT<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

TryT

method TryT<M, A> BindFail (Func<Error, TryT<M, A>> Fail) Source #

Monad bind operation

Parameters

type B

Target bound value type

param Fail

Failure mapping function

returns

TryT

method TryT<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

TryT

method TryT<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

TryT

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

TryT

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

TryT

method TryT<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

TryT

method TryT<M, C> SelectMany <B, C> (Func<A, Fin<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

TryT

method TryT<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

TryT

method TryT<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

TryT

method TryT<M, A> Combine (TryT<M, A> rhs) Source #

Operators

operator >> (TryT<M, A> lhs, TryT<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 >> (TryT<M, A> lhs, K<TryT<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 >> (TryT<M, A> lhs, TryT<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 >> (TryT<M, A> lhs, K<TryT<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 + (TryT<M, A> lhs, TryT<M, A> rhs) Source #

operator + (K<TryT<M>, A> lhs, TryT<M, A> rhs) Source #

operator + (TryT<M, A> lhs, K<TryT<M>, A> rhs) Source #

operator + (TryT<M, A> ma, Pure<A> mb) Source #

operator + (TryT<M, A> ma, Fail<Error> mb) Source #

operator + (TryT<M, A> ma, Fail<Exception> mb) Source #

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

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

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

operator | (TryT<M, A> ma, Pure<A> mb) Source #

operator | (TryT<M, A> ma, Fail<Error> mb) Source #

operator | (TryT<M, A> ma, Fail<Exception> mb) Source #

operator | (TryT<M, A> ma, CatchM<Error, TryT<M>, A> mb) Source #

class TryTExtensions Source #

Either monad extensions

Methods

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

where M : Monad<M>

method K<M, Fin<A>> Run <M, A> (this K<TryT<M>, A> ma) Source #

where M : Monad<M>

Run the transformer

This is where the exceptions are caught

method TryT<M, A> Flatten <M, A> (this K<TryT<M>, TryT<M, A>> mma) Source #

where M : Monad<M>

Monadic join

method TryT<M, A> Flatten <M, A> (this K<TryT<M>, K<TryT<M>, A>> mma) Source #

where M : Monad<M>

Monadic join

method TryT<M, C> SelectMany <M, A, B, C> ( this K<M, A> ma, Func<A, K<TryT<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

TryT

method TryT<M, C> SelectMany <M, A, B, C> ( this K<M, A> ma, Func<A, TryT<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

TryT

class TryTExtensions Source #

Methods

method TryT<M, B> Map <M, A, B> (this Func<A, B> f, K<TryT<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 TryT<M, B> Map <M, A, B> (this Func<A, B> f, TryT<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 TryT<M, B> Action <M, A, B> (this TryT<M, A> ma, K<TryT<M>, B> mb) Source #

where M : Monad<M>

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

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

where M : Monad<M>

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

method TryT<M, B> Apply <M, A, B> (this TryT<M, Func<A, B>> mf, K<TryT<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 TryT<M, B> Apply <M, A, B> (this K<TryT<M>, Func<A, B>> mf, K<TryT<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 TryT <M> Source #

Methods

method TryT<M, A> Succ <A> (A value) Source #

method TryT<M, A> Fail <A> (Error value) Source #

method TryT<M, A> lift <A> (Func<Fin<A>> ma) Source #

method TryT<M, A> lift <A> (Fin<A> ma) Source #

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

method TryT<M, A> lift <A> (Fail<Error> ma) Source #

method TryT<M, A> lift <A> (Error ma) Source #

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

class TryT Source #

Methods

method TryT<M, A> Succ <M, A> (A value) Source #

where M : Monad<M>

method TryT<M, A> Fail <M, A> (Error value) Source #

where M : Monad<M>

method TryT<M, A> lift <M, A> (Func<Fin<A>> ma) Source #

where M : Monad<M>

method TryT<M, A> lift <M, A> (Fin<A> ma) Source #

where M : Monad<M>

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

where M : Monad<M>

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

where M : Monad<M>

method TryT<M, A> lift <M, A> (Fail<Error> ma) Source #

where M : Monad<M>

method TryT<M, A> lift <M, A> (Error ma) Source #

where M : Monad<M>

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

where M : Monad<M>

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

where M : Monad<M>

class TryT <M> Source #

where M : Monad<M>

Trait implementation for TryT

Parameters

type M

Given monad trait

class Prelude Source #

Methods

method TryT<M, B> map <M, A, B> (Func<A, B> f, K<TryT<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 TryT<M, B> action <M, A, B> (K<TryT<M>, A> ma, K<TryT<M>, B> mb) Source #

where M : Monad<M>

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

method TryT<M, B> apply <M, A, B> (K<TryT<M>, Func<A, B>> mf, K<TryT<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