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
aMaybe<T1>The first value.
bMaybe<T2>The second value.
fFunc<T1, T2, TResult>Applied to the two contained values when the two have values.
Returns
- Maybe<TResult>
A Maybe<T> containing the result of
fif the twoaandbcontain values, and one containing no value otherwise.
Type Parameters
T1The type of the first value.
T2The type of the second value.
TResultThe 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
aMaybe<T1>The first value.
bMaybe<T2>The second value.
cMaybe<T3>The third value.
fFunc<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
fifa,bandcall contain values, and one containing no value otherwise.
Type Parameters
T1The type of the first value.
T2The type of the second value.
T3The type of the third value.
TResultThe 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
aMaybe<T1>The first value.
bMaybe<T2>The second value.
cMaybe<T3>The third value.
dMaybe<T4>The fourth value.
fFunc<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
fifa,b,canddall contain values, and one containing no value otherwise.
Type Parameters
T1The type of the first value.
T2The type of the second value.
T3The type of the third value.
T4The type of the fourth value.
TResultThe type of the result.