Table of Contents

Method Match

Namespace
SodaFlow.Functional
Assembly
SodaFlow.Functional.dll

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

Runs one function on the value that the task gives when there is a value, and a different one, and returns its result.

public static Task<TResult> Match<T, TResult>(this Task<Maybe<T>> a, Func<T, TResult> onSome, Func<TResult> onNone)

Parameters

a Task<Maybe<T>>

The task that gives the value for Match.

onSome Func<T, TResult>

Run with the contained value when there is one.

onNone Func<TResult>

Run when there is no value.

Returns

Task<TResult>

A task giving whatever the function that was run returned.

Type Parameters

T

The type of the value, when there is one.

TResult

The type each of the two functions returns.