Method Bind
- Namespace
- SodaFlow.Functional
- Assembly
- SodaFlow.Functional.dll
Bind<T, TResult>(Task<Maybe<T>>, Func<T, Maybe<TResult>>)
Transforms the value the task will give into a second Maybe<T>, if it gives one, flattening the result.
public static Task<Maybe<TResult>> Bind<T, TResult>(this Task<Maybe<T>> a, Func<T, Maybe<TResult>> f)
Parameters
aTask<Maybe<T>>The task giving the value to transform.
fFunc<T, Maybe<TResult>>Run with the contained value when there is one.
Returns
- Task<Maybe<TResult>>
A task giving the result of
fif the awaited value contained a value, and a Maybe<T> containing no value otherwise.
Type Parameters
TThe type of the value, when there is one.
TResultThe type of the value the function produces.