Table of Contents

Method Lift

Namespace
SodaFlow.Functional
Assembly
SodaFlow.Functional.dll

Lift<T1, T2, TResult>(Maybe<T1>, Maybe<T2>, Func<T1, T2, TResult>)

Lift a binary function into values that can be missing, so the result has a value only when the two inputs were.

[Pure]
public static Maybe<TResult> Lift<T1, T2, TResult>(this Maybe<T1> a, Maybe<T2> b, Func<T1, T2, TResult> f)

Parameters

a Maybe<T1>

The first value.

b Maybe<T2>

The second value.

f Func<T1, T2, TResult>

Applied to the two contained values when the two have values.

Returns

Maybe<TResult>

A Maybe<T> containing the result of f if the two a and b contain values, and one containing no value otherwise.

Type Parameters

T1

The type of the first value.

T2

The type of the second value.

TResult

The type of the result.

Remarks

f runs only when each input has a value. Thus, this is the procedure to put some parsed or looked-up values together, with no Match for each input.

Lift<T1, T2, T3, TResult>(Maybe<T1>, Maybe<T2>, Maybe<T3>, Func<T1, T2, T3, TResult>)

Lift a ternary function into values that can be missing, so the result has a value only when all three inputs were.

[Pure]
public static Maybe<TResult> Lift<T1, T2, T3, TResult>(this Maybe<T1> a, Maybe<T2> b, Maybe<T3> c, Func<T1, T2, T3, TResult> f)

Parameters

a Maybe<T1>

The first value.

b Maybe<T2>

The second value.

c Maybe<T3>

The third value.

f Func<T1, T2, T3, TResult>

Applied to the three contained values when each one has a value.

Returns

Maybe<TResult>

A Maybe<T> containing the result of f if a, b and c all contain values, and one containing no value otherwise.

Type Parameters

T1

The type of the first value.

T2

The type of the second value.

T3

The type of the third value.

TResult

The type of the result.

Lift<T1, T2, T3, T4, TResult>(Maybe<T1>, Maybe<T2>, Maybe<T3>, Maybe<T4>, Func<T1, T2, T3, T4, TResult>)

Lift a quaternary function into values that can be missing, so the result has a value only when all four inputs were.

[Pure]
public static Maybe<TResult> Lift<T1, T2, T3, T4, TResult>(this Maybe<T1> a, Maybe<T2> b, Maybe<T3> c, Maybe<T4> d, Func<T1, T2, T3, T4, TResult> f)

Parameters

a Maybe<T1>

The first value.

b Maybe<T2>

The second value.

c Maybe<T3>

The third value.

d Maybe<T4>

The fourth value.

f Func<T1, T2, T3, T4, TResult>

Applied to the four contained values when each one has a value.

Returns

Maybe<TResult>

A Maybe<T> containing the result of f if a, b, c and d all contain values, and one containing no value otherwise.

Type Parameters

T1

The type of the first value.

T2

The type of the second value.

T3

The type of the third value.

T4

The type of the fourth value.

TResult

The type of the result.