Table of Contents

Class ErraticExtensions

Namespace
LfrlAnvil.Functional.Extensions
Assembly
LfrlAnvil.Functional.dll

Contains Erratic<T> extension methods.

public static class ErraticExtensions
Inheritance
ErraticExtensions
Inherited Members

Methods

Reduce<T>(Erratic<Erratic<T>>)

Creates a new Erratic<T> instance.

[Pure]
public static Erratic<T> Reduce<T>(this Erratic<Erratic<T>> source)

Parameters

source Erratic<Erratic<T>>

Source erratic.

Returns

Erratic<T>

New Erratic<T> instance equivalent to the value of source when IsOk of source is equal to true otherwise a new Erratic<T> instance equivalent to the error of source.

Type Parameters

T

Value type.

ToEither<T>(Erratic<T>)

Creates a new Either<T1, T2> instance.

[Pure]
public static Either<T, Exception> ToEither<T>(this Erratic<T> source)

Parameters

source Erratic<T>

Source erratic.

Returns

Either<T, Exception>

New Either<T1, T2> instance equivalent to the value of source when IsOk of source is equal to true otherwise a new Either<T1, T2> instance equivalent to the error of source.

Type Parameters

T

Value type.

ToMaybe<T>(Erratic<T>)

Creates a new Maybe<T> instance.

[Pure]
public static Maybe<T> ToMaybe<T>(this Erratic<T> source) where T : notnull

Parameters

source Erratic<T>

Source erratic.

Returns

Maybe<T>

New Maybe<T> instance equivalent to the provided source or None when source does not have a value.

Type Parameters

T

Value type.