Table of Contents

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

a Task<Maybe<T>>

The task giving the value to transform.

f Func<T, Maybe<TResult>>

Run with the contained value when there is one.

Returns

Task<Maybe<TResult>>

A task giving the result of f if the awaited value contained a value, and a Maybe<T> containing no value otherwise.

Type Parameters

T

The type of the value, when there is one.

TResult

The type of the value the function produces.