Table of Contents

Method Flatten

Namespace
SodaFlow.Functional
Assembly
SodaFlow.Functional.dll

Flatten<T>(Maybe<Maybe<T>>)

Collapses a nested Maybe<T> into a single one.

[Pure]
public static Maybe<T> Flatten<T>(this Maybe<Maybe<T>> a)

Parameters

a Maybe<Maybe<T>>

The nested value.

Returns

Maybe<T>

The inner Maybe<T> if the outer one has a value, and a Maybe<T> containing no value otherwise.

Type Parameters

T

The type of the innermost value.

Remarks

The two conditions with no value give the same result. An outer with no value gives no value, and an outer that holds an inner with no value gives no value.