LanguageExt.Core

LanguageExt.Core Monads Alternative Monads FinT

Contents

Sub modules

Extensions
Operators
Trait

record FinT <M, A> (K<M, Fin<A>> runFin) Source #

where M : Monad<M>

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

Parameters

type M

Given monad trait

type A

Bound value type

Properties

property K<M, bool> IsSucc Source #

Is the FinT in a Succ state?

property K<M, bool> IsFail Source #

Is the FinT in a Fail state?

Methods

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

Invokes the Succ or Fail function depending on the state of the FinT

Parameters

type B

Return type

param Fail

Function to invoke if in a Fail state

param Succ

Function to invoke if in a Succ state

returns

The return value of the invoked function

method K<M, Unit> Match (Action<A> Succ, Action<Error> Fail) Source #

Invokes the Succ or Fail function depending on the state of the FinT

Parameters

param Succ

Action to invoke if in a Succ state

param Fail

Action to invoke if in a Fail state

returns

Unit

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

Executes the Fail function if the Fin is in a Fail state. Returns the Succ value if the Fin is in a Succ state.

Parameters

param Fail

Function to generate a Succ value if in the Fail state

returns

Returns an unwrapped Succ value

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

Executes the f function if the Fin is in a Fail state. Returns the Succ value if the Fin is in a Succ state.

Parameters

param f

Function to generate a Succ value if in the Fail state

returns

Returns an unwrapped Succ value

method K<M, A> IfFail (A value) Source #

Returns the value if the Fin is in a Fail state. Returns the Succ value if the Fin is in a Succ state.

Parameters

param value

Value to return if in the Fail state

returns

Returns an unwrapped Succ value

method K<M, Unit> IfFail (Action<Error> Fail) Source #

Executes the Fail action if the Fin is in a Fail state.

Parameters

param Fail

Function to generate a Succ value if in the Fail state

returns

Returns an unwrapped Succ value

method K<M, Unit> IfSucc (Action<A> Succ) Source #

Invokes the Succ action if the Fin is in a Succ state, otherwise does nothing

Parameters

param Succ

Action to invoke

returns

Unit

method K<M, Error> IfSucc (Error fail) Source #

Returns the fail value if the Fin is in a Succ state. Returns the Fail value if the Fin is in a Fail state.

Parameters

param fail

Value to return if in the Succ state

returns

Returns an unwrapped Fail value

method K<M, Error> IfSucc (Func<Error> Succ) Source #

Returns the result of Succ() if the Fin is in a Succ state. Returns the Fail value if the Fin is in a Fail state.

Parameters

param Succ

Function to generate a Fail value if in the Succ state

returns

Returns an unwrapped Fail value

method K<M, Error> IfSucc (Func<A, Error> f) Source #

Returns the result of f if the Fin is in a Succ state. Returns the Fail value if the Fin is in a Fail state.

Parameters

param f

Function to generate a Fail value if in the Succ state

returns

Returns an unwrapped Fail value

method FinT<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 FinT<M, B> MapM <B> (Func<K<M, A>, K<M, B>> f) Source #

Maps the given monad

Parameters

param f

Mapping function

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

FinT

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

Maps the Error value

Parameters

type B

Target bound value type

param f

Mapping function

returns

FinT

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

FinT

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

Monad bind operation

Parameters

type B

Target bound value type

param f

Mapping function

returns

FinT

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

Monad bind operation

Parameters

type B

Target bound value type

param f

Mapping function

returns

FinT

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

Monad bind operation

Parameters

type B

Target bound value type

param f

Mapping function

returns

FinT

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

FinT

method FinT<M, B> Bind <B> (Func<A, Fail<Error>> f) Source #

Monad bind operation

Parameters

type B

Target bound value type

param f

Mapping function

returns

FinT

method FinT<M, B> BiBind <B> (Func<Error, FinT<M, B>> Fail, Func<A, FinT<M, B>> Succ) Source #

Monad bi-bind operation

Parameters

type B

Target bound value type

param Fail

Fail state mapping function

param Succ

Fail state mapping function

returns

FinT

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

Monad bi-bind operation

Parameters

param Fail

Fail state mapping function

returns

FinT

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

FinT

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

FinT

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

FinT

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

FinT

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

FinT

method OptionT<M, A> ToOption () Source #

method EitherT<Error, M, A> ToEither () Source #

method ValidationT<Error, M, A> ToValidation () Source #

class FinT Source #

Methods

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

where M : Monad<M>

Lift a pure value into the monad-transformer

Parameters

param value

Value to lift

returns

FinT

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

where M : Monad<M>

Lift a fail value into the monad-transformer

Parameters

param value

Value to lift

returns

FinT

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

where M : Monad<M>

Lifts a given Fin value into the transformer

Parameters

param ma

Fin value

returns

FinT

method FinT<M, A> lift <M, A> (Pure<A> value) Source #

where M : Monad<M>

Lifts a given pure value into the transformer

Parameters

param ma

Value to lift

returns

FinT

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

where M : Monad<M>

Lifts a given failure value into the transformer

Parameters

param fail

Value to lift

returns

FinT

method FinT<M, A> lift <M, A> (K<M, A> monad) Source #

where M : Monad<M>

Lifts a given monad into the transformer

Parameters

param monad

Monad to lift

returns

FinT

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

where M : Monad<M>

Lifts a given monad into the transformer

Parameters

param ma

Monad to lift

returns

FinT

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

where M : MonadIO<M>

Lifts a given IO monad into the transformer

Parameters

param ma

Monad to lift

returns

FinT

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

where M : MonadIO<M>

Lifts a given IO monad into the transformer

Parameters

param ma

Monad to lift

returns

FinT