Table of Contents

Method Map

Namespace
SodaFlow.Functional
Assembly
SodaFlow.Functional.dll

Map<T, TResult>(Task<Maybe<T>>, Func<T, TResult>)

Transforms the value the task will give, if it gives one.

public static Task<Maybe<TResult>> Map<T, TResult>(this Task<Maybe<T>> a, Func<T, TResult> f)

Parameters

a Task<Maybe<T>>

The task giving the value to transform.

f Func<T, TResult>

Run with the contained value when there is one.

Returns

Task<Maybe<TResult>>

A task giving a Maybe<T> containing the result of f if the awaited value contained one, and one 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.