OptionExtensions Class

Extension methods for Option

DECLARATION
public static class OptionExtensions
NAMESPACE

Methods

Action<A, B>(Option<A>, Option<B>)
SUMMARY

Evaluate fa, then fb, ignoring the result of fa

PARAMETERS
fa
Option<A>
Applicative to evaluate first
fb
Option<B>
Applicative to evaluate second and then return
DECLARATION
[Pure]
public static Option<B> Action<A, B>(this Option<A> fa, Option<B> fb)
RETURNS
Option<B>
Applicative of type Option<B>
Add<NUM, A>(Option<A>, Option<A>)
SUMMARY

Add the bound values of x and y, uses an Add type-class to provide the add operation for type A. For example x.Add<TInteger,int>(y)

PARAMETERS
x
Option<A>
Left hand side of the operation
y
Option<A>
Right hand side of the operation
DECLARATION
[Pure]
public static Option<A> Add<NUM, A>(this Option<A> x, Option<A> y)
RETURNS
Option<A>
An option with y added to x
CONSTRAINTS
where NUM : struct Num<A>
Apply<A, B, C>(Option<Func<A, B, C>>, Option<A>, Option<B>)
SUMMARY

Apply

PARAMETERS
fabc
Option<Func<A, B, C>>
fa
Option<A>
Applicative a to apply
fb
Option<B>
Applicative b to apply
DECLARATION
[Pure]
public static Option<C> Apply<A, B, C>(this Option<Func<A, B, C>> fabc, Option<A> fa, Option<B> fb)
RETURNS
Option<C>
Applicative of type FC derived from Applicative of C
Apply<A, B, C>(Func<A, B, C>, Option<A>, Option<B>)
SUMMARY

Apply

PARAMETERS
fabc
Func<A, B, C>
fa
Option<A>
Applicative a to apply
fb
Option<B>
Applicative b to apply
DECLARATION
[Pure]
public static Option<C> Apply<A, B, C>(this Func<A, B, C> fabc, Option<A> fa, Option<B> fb)
RETURNS
Option<C>
Applicative of type FC derived from Applicative of C
Apply<A, B, C>(Option<Func<A, B, C>>, Option<A>)
SUMMARY

Apply

PARAMETERS
fabc
Option<Func<A, B, C>>
fa
Option<A>
Applicative to apply
DECLARATION
[Pure]
public static Option<Func<B, C>> Apply<A, B, C>(this Option<Func<A, B, C>> fabc, Option<A> fa)
RETURNS
Option<Func<B, C>>
Applicative of type f(b -> c) derived from Applicative of Func<B, C>
Apply<A, B, C>(Func<A, B, C>, Option<A>)
SUMMARY

Apply

PARAMETERS
fabc
Func<A, B, C>
fa
Option<A>
Applicative to apply
DECLARATION
[Pure]
public static Option<Func<B, C>> Apply<A, B, C>(this Func<A, B, C> fabc, Option<A> fa)
RETURNS
Option<Func<B, C>>
Applicative of type f(b -> c) derived from Applicative of Func<B, C>
Apply<A, B, C>(Option<Func<A, Func<B, C>>>, Option<A>)
SUMMARY

Apply

PARAMETERS
fabc
Option<Func<A, Func<B, C>>>
fa
Option<A>
Applicative to apply
DECLARATION
[Pure]
public static Option<Func<B, C>> Apply<A, B, C>(this Option<Func<A, Func<B, C>>> fabc, Option<A> fa)
RETURNS
Option<Func<B, C>>
Applicative of type f(b -> c) derived from Applicative of Func<B, C>
Apply<A, B, C>(Func<A, Func<B, C>>, Option<A>)
SUMMARY

Apply

PARAMETERS
fabc
Func<A, Func<B, C>>
fa
Option<A>
Applicative to apply
DECLARATION
[Pure]
public static Option<Func<B, C>> Apply<A, B, C>(this Func<A, Func<B, C>> fabc, Option<A> fa)
RETURNS
Option<Func<B, C>>
Applicative of type f(b -> c) derived from Applicative of Func<B, C>
Apply<A, B>(Option<Func<A, B>>, Option<A>)
SUMMARY

Apply

PARAMETERS
fab
Option<Func<A, B>>
Function to apply the applicative to
fa
Option<A>
Applicative to apply
DECLARATION
[Pure]
public static Option<B> Apply<A, B>(this Option<Func<A, B>> fab, Option<A> fa)
RETURNS
Option<B>
Applicative of type FB derived from Applicative of B
Apply<A, B>(Func<A, B>, Option<A>)
SUMMARY

Apply

PARAMETERS
fab
Func<A, B>
Function to apply the applicative to
fa
Option<A>
Applicative to apply
DECLARATION
[Pure]
public static Option<B> Apply<A, B>(this Func<A, B> fab, Option<A> fa)
RETURNS
Option<B>
Applicative of type FB derived from Applicative of B
Divide<NUM, A>(Option<A>, Option<A>)
SUMMARY

Divide the two bound values of x and y, uses a Divide type-class to provide the divide operation for type A. For example x.Divide<TDouble,double>(y)

PARAMETERS
x
Option<A>
Left hand side of the operation
y
Option<A>
Right hand side of the operation
DECLARATION
[Pure]
public static Option<A> Divide<NUM, A>(this Option<A> x, Option<A> y)
RETURNS
Option<A>
An option x / y
CONSTRAINTS
where NUM : struct Num<A>
Match<T, R>(IEnumerable<Option<T>>, Func<T, IEnumerable<R>>, Func<IEnumerable<R>>)
SUMMARY

Match over a list of options

PARAMETERS
list
IEnumerable<Option<T>>
List of options to match against
Some
Func<T, IEnumerable<R>>
Operation to perform when an Option is in the Some state
None
Func<IEnumerable<R>>
Operation to perform when an Option is in the None state
DECLARATION
[Pure]
public static IEnumerable<R> Match<T, R>(this IEnumerable<Option<T>> list, Func<T, IEnumerable<R>> Some, Func<IEnumerable<R>> None)
RETURNS
IEnumerable<R>
An enumerable of results of the match operations
Match<T, R>(IEnumerable<Option<T>>, Func<T, IEnumerable<R>>, IEnumerable<R>)
SUMMARY

Match over a list of options

PARAMETERS
list
IEnumerable<Option<T>>
List of options to match against
Some
Func<T, IEnumerable<R>>
Operation to perform when an Option is in the Some state
None
IEnumerable<R>
Default if the list is empty
DECLARATION
[Pure]
public static IEnumerable<R> Match<T, R>(this IEnumerable<Option<T>> list, Func<T, IEnumerable<R>> Some, IEnumerable<R> None)
RETURNS
IEnumerable<R>
An enumerable of results of the match operations
MatchObservable<A, B>(Option<A>, Func<A, IObservable<B>>, Func<B>)
SUMMARY

Match the two states of the Option and return an observable stream of non-null Rs.

PARAMETERS
ma
Option<A>
Some
Func<A, IObservable<B>>
Some handler. Must not return null.
None
Func<B>
None handler. Must not return null.
DECLARATION
[Pure]
public static IObservable<B> MatchObservable<A, B>(this Option<A> ma, Func<A, IObservable<B>> Some, Func<B> None)
RETURNS
IObservable<B>
A stream of non-null Rs
MatchObservable<A, B>(Option<A>, Func<A, IObservable<B>>, Func<IObservable<B>>)
SUMMARY

Match the two states of the Option and return an observable stream of non-null Rs.

PARAMETERS
ma
Option<A>
Some
Func<A, IObservable<B>>
Some handler. Must not return null.
None
Func<IObservable<B>>
None handler. Must not return null.
DECLARATION
[Pure]
public static IObservable<B> MatchObservable<A, B>(this Option<A> ma, Func<A, IObservable<B>> Some, Func<IObservable<B>> None)
RETURNS
IObservable<B>
A stream of non-null Rs
Product<NUM, A>(Option<A>, Option<A>)
SUMMARY

Find the product between the two bound values of x and y, uses a Product type-class to provide the product operation for type A. For example x.Product<TInteger,int>(y)

PARAMETERS
x
Option<A>
Left hand side of the operation
y
Option<A>
Right hand side of the operation
DECLARATION
[Pure]
public static Option<A> Product<NUM, A>(this Option<A> x, Option<A> y)
RETURNS
Option<A>
An option with the product of x and y
CONSTRAINTS
where NUM : struct Num<A>
Somes<A>(IEnumerable<Option<A>>)
SUMMARY

Extracts from a list of 'Option' all the 'Some' elements. All the 'Some' elements are extracted in order.

PARAMETERS
self
IEnumerable<Option<A>>
DECLARATION
[Pure]
public static IEnumerable<A> Somes<A>(this IEnumerable<Option<A>> self)
RETURNS
IEnumerable<A>
Subtract<NUM, A>(Option<A>, Option<A>)
SUMMARY

Find the subtract between the two bound values of x and y, uses a Subtract type-class to provide the subtract operation for type A. For example x.Subtract<TInteger,int>(y)

PARAMETERS
x
Option<A>
Left hand side of the operation
y
Option<A>
Right hand side of the operation
DECLARATION
[Pure]
public static Option<A> Subtract<NUM, A>(this Option<A> x, Option<A> y)
RETURNS
Option<A>
An option with the subtract between x and y
CONSTRAINTS
where NUM : struct Num<A>
Sum(Option<int>)
SUMMARY

Sum the bound value

PARAMETERS
a
Option<int>
Option of int
REMARKS
This is a legacy method for backwards compatibility
DECLARATION
public static int Sum(this Option<int> a)
RETURNS
int
The bound value or 0 if None
Sum<NUM, A>(Option<A>)
SUMMARY

Sum the bound value

PARAMETERS
self
Option<A>
Option of A that is from the type-class NUM
REMARKS
This is a legacy method for backwards compatibility
DECLARATION
public static A Sum<NUM, A>(this Option<A> self)
RETURNS
A
The bound value or 0 if None
CONSTRAINTS
where NUM : struct Num<A>
ToNullable<A>(Option<A>)
SUMMARY

Convert the Option type to a Nullable of A

PARAMETERS
ma
Option<A>
Option to convert
DECLARATION
[Pure]
public static A? ToNullable<A>(this Option<A> ma)
RETURNS
A?
Nullable of A
CONSTRAINTS
where A : struct