LanguageExt.Core

LanguageExt.Core Monads Alternative Monads Try

Contents

record Try <A> (Func<Fin<A>> runTry) Source #

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 Try<A> Succ (A value) Source #

Lift a pure value into the monad-transformer

Parameters

param value

Value to lift

returns

TryT

method Try<A> Fail (Error value) Source #

Lift a fail value into the monad-transformer

Parameters

param value

Value to lift

returns

TryT

method Try<A> Lift (Pure<A> pure) Source #

Lifts a given monad into the transformer

Parameters

param pure

Monad to lift

returns

TryT

method Try<A> Lift (Fin<A> result) Source #

Lifts a given monad into the transformer

Parameters

param either

Monad to lift

returns

TryT

method Try<A> Lift (Func<Fin<A>> result) Source #

Lifts a given monad into the transformer

Parameters

param either

Monad to lift

returns

TryT

method Try<A> Lift (Func<A> result) Source #

Lifts a given monad into the transformer

Parameters

param either

Monad to lift

returns

TryT

method Try<A> Lift (Fail<Error> fail) Source #

Lifts a given monad into the transformer

Parameters

param fail

Monad to lift

returns

TryT

method 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 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 Fin<A> IfFailM (Func<Error, Fin<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 Try<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 Try<A> MapFail (Func<Error, Error> f) Source #

Maps the bound value

Parameters

param f

Mapping function

returns

TryT

method Try<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 Try<B> Bind <B> (Func<A, K<Try, B>> f) Source #

Monad bind operation

Parameters

type B

Target bound value type

param f

Mapping function

returns

TryT

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

Monad bind operation

Parameters

type B

Target bound value type

param f

Mapping function

returns

TryT

method Try<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 Try<B> BiBind <B> (Func<A, Try<B>> Succ, Func<Error, Try<B>> Fail) Source #

Monad bind operation

Parameters

type B

Target bound value type

param Succ

Mapping function

returns

TryT

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

Monad bind operation

Parameters

type B

Target bound value type

param Succ

Mapping function

returns

TryT

method Try<C> SelectMany <B, C> (Func<A, K<Try, 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 Try<C> SelectMany <B, C> (Func<A, Try<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 Try<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 Try<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 Try<A> Combine (Try<A> rhs) Source #

Operators

operator + (Try<A> lhs, Try<A> rhs) Source #

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

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

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

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

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

operator + (Try<A> ma, Exception mb) Source #

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

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

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

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

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

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

operator | (Try<A> ma, Exception mb) Source #

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

class TryExtensions Source #

Either monad extensions

Methods

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

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

Run the Try

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

Monadic join

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

Monadic join

class TryExtensions Source #

Methods

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

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

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

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

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

Methods

method Try<A> Succ <A> (A value) Source #

method Try<A> Fail <A> (Error value) Source #

method Try<A> lift <A> (Func<Fin<A>> ma) Source #

method Try<A> lift <A> (Fin<A> ma) Source #

method Try<A> lift <A> (Pure<A> ma) Source #

method Try<A> lift <A> (Fail<Error> ma) Source #

method Try<A> lift <A> (Error ma) Source #

method Try<A> lift <A> (Func<A> f) Source #

method Fin<B> match <A, B> (Try<A> ma, Func<A, B> Succ, Func<Error, B> Fail) Source #

class Try Source #

Trait implementation for Try

class Prelude Source #

Methods

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

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

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