OptionAsync<A> Struct

Discriminated union type. Can be in one of two states:

Some(a)
None


Typeclass instances available for this type:

Applicative : ApplOptionAsync
BiFoldable : MOptionAsync
Foldable : MOptionAsync
Functor : FOptionAsync
Monad : MOptionAsync
OptionalAsync : MOptionAsync


DECLARATION
public struct OptionAsync<A> : IOptionalAsync
NAMESPACE
LanguageExt

Fields

None
SUMMARY

None

DECLARATION
public static readonly OptionAsync<A> None

Properties

IsLazy
SUMMARY

True if this instance evaluates lazily

DECLARATION
[Pure]
public bool IsLazy { get; }
RETURNS
bool
IsNone
SUMMARY

Is the option in a None state

DECLARATION
[Pure]
public Task<bool> IsNone { get; }
RETURNS
Task<bool>
IsSome
SUMMARY

Is the option in a Some state

DECLARATION
[Pure]
public Task<bool> IsSome { get; }
RETURNS
Task<bool>

Methods

AsEnumerable()
SUMMARY

Convert the Option to an enumerable of zero or one items

DECLARATION
[Pure]
public Task<Seq<A>> AsEnumerable()
RETURNS
Task<Seq<A>>
An enumerable of zero or one items
BiExists(Func<A, bool>, Func<Unit, bool>)
SUMMARY

Apply a predicate to the bound value. If the Option is in a None state then True is returned if invoking None returns True. If the Option is in a Some state the value is the result of running applying the bound value to the Some predicate supplied.

PARAMETERS
Some
Func<A, bool>
None
Func<Unit, bool>
DECLARATION
[Pure]
public Task<bool> BiExists(Func<A, bool> Some, Func<Unit, bool> None)
RETURNS
Task<bool>
If the Option is in a None state then True is returned if invoking None returns True. If the Option is in a Some state the value is the result of running applying the bound value to the Some predicate supplied.
BiExists(Func<A, bool>, Func<bool>)
SUMMARY

Apply a predicate to the bound value. If the Option is in a None state then True is returned if invoking None returns True. If the Option is in a Some state the value is the result of running applying the bound value to the Some predicate supplied.

PARAMETERS
Some
Func<A, bool>
None
Func<bool>
DECLARATION
[Pure]
public Task<bool> BiExists(Func<A, bool> Some, Func<bool> None)
RETURNS
Task<bool>
If the Option is in a None state then True is returned if invoking None returns True. If the Option is in a Some state the value is the result of running applying the bound value to the Some predicate supplied.
BiFold<S>(S, Func<S, A, S>, Func<S, Unit, S>)
SUMMARY

Option types are like lists of 0 or 1 items, and therefore follow the same rules when folding.

In the case of lists, 'Fold', when applied to a binary operator, a starting value(typically the left-identity of the operator), and a list, reduces the list using the binary operator, from left to right:

Note that, since the head of the resulting expression is produced by an application of the operator to the first element of the list, 'Fold' can produce a terminating expression from an infinite list.

PARAMETERS
state
S
Initial state
Some
Func<S, A, S>
Folder function, applied if Option is in a Some state
None
Func<S, Unit, S>
Folder function, applied if Option is in a None state
DECLARATION
[Pure]
public Task<S> BiFold<S>(S state, Func<S, A, S> Some, Func<S, Unit, S> None)
RETURNS
Task<S>
The aggregate state
BiFold<S>(S, Func<S, A, Task<S>>, Func<S, Unit, S>)
SUMMARY

Option types are like lists of 0 or 1 items, and therefore follow the same rules when folding.

In the case of lists, 'Fold', when applied to a binary operator, a starting value(typically the left-identity of the operator), and a list, reduces the list using the binary operator, from left to right:

Note that, since the head of the resulting expression is produced by an application of the operator to the first element of the list, 'Fold' can produce a terminating expression from an infinite list.

PARAMETERS
state
S
Initial state
Some
Func<S, A, Task<S>>
Folder function, applied if Option is in a Some state
None
Func<S, Unit, S>
Folder function, applied if Option is in a None state
DECLARATION
[Pure]
public Task<S> BiFold<S>(S state, Func<S, A, Task<S>> Some, Func<S, Unit, S> None)
RETURNS
Task<S>
The aggregate state
BiFold<S>(S, Func<S, A, S>, Func<S, Unit, Task<S>>)
SUMMARY

Option types are like lists of 0 or 1 items, and therefore follow the same rules when folding.

In the case of lists, 'Fold', when applied to a binary operator, a starting value(typically the left-identity of the operator), and a list, reduces the list using the binary operator, from left to right:

Note that, since the head of the resulting expression is produced by an application of the operator to the first element of the list, 'Fold' can produce a terminating expression from an infinite list.

PARAMETERS
state
S
Initial state
Some
Func<S, A, S>
Folder function, applied if Option is in a Some state
None
Func<S, Unit, Task<S>>
Folder function, applied if Option is in a None state
DECLARATION
[Pure]
public Task<S> BiFold<S>(S state, Func<S, A, S> Some, Func<S, Unit, Task<S>> None)
RETURNS
Task<S>
The aggregate state
BiFold<S>(S, Func<S, A, Task<S>>, Func<S, Unit, Task<S>>)
SUMMARY

Option types are like lists of 0 or 1 items, and therefore follow the same rules when folding.

In the case of lists, 'Fold', when applied to a binary operator, a starting value(typically the left-identity of the operator), and a list, reduces the list using the binary operator, from left to right:

Note that, since the head of the resulting expression is produced by an application of the operator to the first element of the list, 'Fold' can produce a terminating expression from an infinite list.

PARAMETERS
state
S
Initial state
Some
Func<S, A, Task<S>>
Folder function, applied if Option is in a Some state
None
Func<S, Unit, Task<S>>
Folder function, applied if Option is in a None state
DECLARATION
[Pure]
public Task<S> BiFold<S>(S state, Func<S, A, Task<S>> Some, Func<S, Unit, Task<S>> None)
RETURNS
Task<S>
The aggregate state
BiFold<S>(S, Func<S, A, S>, Func<S, S>)
SUMMARY

Option types are like lists of 0 or 1 items, and therefore follow the same rules when folding.

In the case of lists, 'Fold', when applied to a binary operator, a starting value(typically the left-identity of the operator), and a list, reduces the list using the binary operator, from left to right:

Note that, since the head of the resulting expression is produced by an application of the operator to the first element of the list, 'Fold' can produce a terminating expression from an infinite list.

PARAMETERS
state
S
Initial state
Some
Func<S, A, S>
Folder function, applied if Option is in a Some state
None
Func<S, S>
Folder function, applied if Option is in a None state
DECLARATION
[Pure]
public Task<S> BiFold<S>(S state, Func<S, A, S> Some, Func<S, S> None)
RETURNS
Task<S>
The aggregate state
BiFold<S>(S, Func<S, A, Task<S>>, Func<S, S>)
SUMMARY

Option types are like lists of 0 or 1 items, and therefore follow the same rules when folding.

In the case of lists, 'Fold', when applied to a binary operator, a starting value(typically the left-identity of the operator), and a list, reduces the list using the binary operator, from left to right:

Note that, since the head of the resulting expression is produced by an application of the operator to the first element of the list, 'Fold' can produce a terminating expression from an infinite list.

PARAMETERS
state
S
Initial state
Some
Func<S, A, Task<S>>
Folder function, applied if Option is in a Some state
None
Func<S, S>
Folder function, applied if Option is in a None state
DECLARATION
[Pure]
public Task<S> BiFold<S>(S state, Func<S, A, Task<S>> Some, Func<S, S> None)
RETURNS
Task<S>
The aggregate state
BiFold<S>(S, Func<S, A, S>, Func<S, Task<S>>)
SUMMARY

Option types are like lists of 0 or 1 items, and therefore follow the same rules when folding.

In the case of lists, 'Fold', when applied to a binary operator, a starting value(typically the left-identity of the operator), and a list, reduces the list using the binary operator, from left to right:

Note that, since the head of the resulting expression is produced by an application of the operator to the first element of the list, 'Fold' can produce a terminating expression from an infinite list.

PARAMETERS
state
S
Initial state
Some
Func<S, A, S>
Folder function, applied if Option is in a Some state
None
Func<S, Task<S>>
Folder function, applied if Option is in a None state
DECLARATION
[Pure]
public Task<S> BiFold<S>(S state, Func<S, A, S> Some, Func<S, Task<S>> None)
RETURNS
Task<S>
The aggregate state
BiFold<S>(S, Func<S, A, Task<S>>, Func<S, Task<S>>)
SUMMARY

Option types are like lists of 0 or 1 items, and therefore follow the same rules when folding.

In the case of lists, 'Fold', when applied to a binary operator, a starting value(typically the left-identity of the operator), and a list, reduces the list using the binary operator, from left to right:

Note that, since the head of the resulting expression is produced by an application of the operator to the first element of the list, 'Fold' can produce a terminating expression from an infinite list.

PARAMETERS
state
S
Initial state
Some
Func<S, A, Task<S>>
Folder function, applied if Option is in a Some state
None
Func<S, Task<S>>
Folder function, applied if Option is in a None state
DECLARATION
[Pure]
public Task<S> BiFold<S>(S state, Func<S, A, Task<S>> Some, Func<S, Task<S>> None)
RETURNS
Task<S>
The aggregate state
BiForAll(Func<A, bool>, Func<Unit, bool>)
SUMMARY

Apply a predicate to the bound value. If the Option is in a None state then True is returned if invoking None returns True. If the Option is in a Some state the value is the result of running applying the bound value to the Some predicate supplied.

PARAMETERS
Some
Func<A, bool>
Predicate to apply if in a Some state
None
Func<Unit, bool>
Predicate to apply if in a None state
DECLARATION
[Pure]
public Task<bool> BiForAll(Func<A, bool> Some, Func<Unit, bool> None)
RETURNS
Task<bool>
If the Option is in a None state then True is returned if invoking None returns True. If the Option is in a Some state the value is the result of running applying the bound value to the Some predicate supplied.
BiForAll(Func<A, bool>, Func<bool>)
SUMMARY

Apply a predicate to the bound value. If the Option is in a None state then True is returned if invoking None returns True. If the Option is in a Some state the value is the result of running applying the bound value to the Some predicate supplied.

PARAMETERS
Some
Func<A, bool>
Predicate to apply if in a Some state
None
Func<bool>
Predicate to apply if in a None state
DECLARATION
[Pure]
public Task<bool> BiForAll(Func<A, bool> Some, Func<bool> None)
RETURNS
Task<bool>
If the Option is in a None state then True is returned if invoking None returns True. If the Option is in a Some state the value is the result of running applying the bound value to the Some predicate supplied.
BiIter(Action<A>, Action<Unit>)
SUMMARY

Invoke an action depending on the state of the Option

PARAMETERS
Some
Action<A>
Action to invoke if in a Some state
None
Action<Unit>
Action to invoke if in a None state
DECLARATION
[Pure]
public Task<Unit> BiIter(Action<A> Some, Action<Unit> None)
RETURNS
Task<Unit>
BiIter(Action<A>, Action)
SUMMARY

Invoke an action depending on the state of the Option

PARAMETERS
Some
Action<A>
Action to invoke if in a Some state
None
Action
Action to invoke if in a None state
DECLARATION
[Pure]
public Task<Unit> BiIter(Action<A> Some, Action None)
RETURNS
Task<Unit>
BiMap<B>(Func<A, B>, Func<Unit, B>)
SUMMARY

Projection from one value to another

PARAMETERS
Some
Func<A, B>
Projection function
None
Func<Unit, B>
Projection function
DECLARATION
[Pure]
public OptionAsync<B> BiMap<B>(Func<A, B> Some, Func<Unit, B> None)
RETURNS
OptionAsync<B>
Mapped functor
BiMap<B>(Func<A, B>, Func<B>)
SUMMARY

Projection from one value to another

PARAMETERS
Some
Func<A, B>
Projection function
None
Func<B>
Projection function
DECLARATION
[Pure]
public OptionAsync<B> BiMap<B>(Func<A, B> Some, Func<B> None)
RETURNS
OptionAsync<B>
Mapped functor
Bind<B>(Func<A, OptionAsync<B>>)
SUMMARY

Monad bind operation

PARAMETERS
f
Func<A, OptionAsync<B>>
DECLARATION
[Pure]
public OptionAsync<B> Bind<B>(Func<A, OptionAsync<B>> f)
RETURNS
OptionAsync<B>
Count()
SUMMARY

Return the number of bound values in this structure:

None = 0


Some = 1


DECLARATION
[Pure]
public Task<int> Count()
RETURNS
Task<int>
Exists(Func<A, bool>)
SUMMARY

Apply a predicate to the bound value. If the Option is in a None state then True is returned if invoking None returns True. If the Option is in a Some state the value is the result of running applying the bound value to the Some predicate supplied.

PARAMETERS
pred
Func<A, bool>
DECLARATION
[Pure]
public Task<bool> Exists(Func<A, bool> pred)
RETURNS
Task<bool>
If the Option is in a None state then True is returned if invoking None returns True. If the Option is in a Some state the value is the result of running applying the bound value to the Some predicate supplied.
Filter(Func<A, bool>)
SUMMARY

Apply a predicate to the bound value (if in a Some state)

PARAMETERS
pred
Func<A, bool>
Predicate to apply
DECLARATION
[Pure]
public OptionAsync<A> Filter(Func<A, bool> pred)
RETURNS
OptionAsync<A>
Some(x) if the Option is in a Some state and the predicate returns True. None otherwise.
Fold<S>(S, Func<S, A, S>)
SUMMARY

Option types are like lists of 0 or 1 items, and therefore follow the same rules when folding.

In the case of lists, 'Fold', when applied to a binary operator, a starting value(typically the left-identity of the operator), and a list, reduces the list using the binary operator, from left to right:

Note that, since the head of the resulting expression is produced by an application of the operator to the first element of the list, 'Fold' can produce a terminating expression from an infinite list.

PARAMETERS
state
S
Initial state
folder
Func<S, A, S>
Folder function, applied if Option is in a Some state
DECLARATION
[Pure]
public Task<S> Fold<S>(S state, Func<S, A, S> folder)
RETURNS
Task<S>
The aggregate state
Fold<S>(S, Func<S, A, Task<S>>)
SUMMARY

Option types are like lists of 0 or 1 items, and therefore follow the same rules when folding.

In the case of lists, 'Fold', when applied to a binary operator, a starting value(typically the left-identity of the operator), and a list, reduces the list using the binary operator, from left to right:

Note that, since the head of the resulting expression is produced by an application of the operator to the first element of the list, 'Fold' can produce a terminating expression from an infinite list.

PARAMETERS
state
S
Initial state
folder
Func<S, A, Task<S>>
Folder function, applied if Option is in a Some state
DECLARATION
[Pure]
public Task<S> Fold<S>(S state, Func<S, A, Task<S>> folder)
RETURNS
Task<S>
The aggregate state
FoldBack<S>(S, Func<S, A, S>)
SUMMARY

Option types are like lists of 0 or 1 items, and therefore follow the same rules when folding.

In the case of lists, 'Fold', when applied to a binary operator, a starting value(typically the left-identity of the operator), and a list, reduces the list using the binary operator, from left to right:

Note that, since the head of the resulting expression is produced by an application of the operator to the first element of the list, 'Fold' can produce a terminating expression from an infinite list.

PARAMETERS
state
S
Initial state
folder
Func<S, A, S>
Folder function, applied if Option is in a Some state
DECLARATION
[Pure]
public Task<S> FoldBack<S>(S state, Func<S, A, S> folder)
RETURNS
Task<S>
The aggregate state
FoldBack<S>(S, Func<S, A, Task<S>>)
SUMMARY

Option types are like lists of 0 or 1 items, and therefore follow the same rules when folding.

In the case of lists, 'Fold', when applied to a binary operator, a starting value(typically the left-identity of the operator), and a list, reduces the list using the binary operator, from left to right:

Note that, since the head of the resulting expression is produced by an application of the operator to the first element of the list, 'Fold' can produce a terminating expression from an infinite list.

PARAMETERS
state
S
Initial state
folder
Func<S, A, Task<S>>
Folder function, applied if Option is in a Some state
DECLARATION
[Pure]
public Task<S> FoldBack<S>(S state, Func<S, A, Task<S>> folder)
RETURNS
Task<S>
The aggregate state
ForAll(Func<A, bool>)
SUMMARY

Apply a predicate to the bound value. If the Option is in a None state then True is returned (because the predicate applies for-all values). If the Option is in a Some state the value is the result of running applying the bound value to the predicate supplied.

PARAMETERS
pred
Func<A, bool>
DECLARATION
[Pure]
public Task<bool> ForAll(Func<A, bool> pred)
RETURNS
Task<bool>
If the Option is in a None state then True is returned (because the predicate applies for-all values). If the Option is in a Some state the value is the result of running applying the bound value to the predicate supplied.
GetHashCode()
SUMMARY

Calculate the hash-code from the bound value, unless the Option is in a None state, in which case the hash-code will be 0

DECLARATION
[Pure]
public override int GetHashCode()
RETURNS
int
Hash-code from the bound value, unless the Option is in a None state, in which case the hash-code will be 0
GetUnderlyingType()
SUMMARY

Get the Type of the bound value

DECLARATION
[Pure]
public Type GetUnderlyingType()
RETURNS
Type
Type of the bound value
IfNone(Func<A>)
SUMMARY

Returns the result of invoking the None() operation if the optional is in a None state, otherwise the bound Some(x) value is returned.

PARAMETERS
None
Func<A>
Operation to invoke if the structure is in a None state
REMARKS
Will not accept a null return value from the None operation
DECLARATION
[Pure]
public Task<A> IfNone(Func<A> None)
RETURNS
Task<A>
Tesult of invoking the None() operation if the optional is in a None state, otherwise the bound Some(x) value is returned.
IfNone(Func<Task<A>>)
SUMMARY

Returns the result of invoking the None() operation if the optional is in a None state, otherwise the bound Some(x) value is returned.

PARAMETERS
None
Func<Task<A>>
Operation to invoke if the structure is in a None state
REMARKS
Will not accept a null return value from the None operation
DECLARATION
[Pure]
public Task<A> IfNone(Func<Task<A>> None)
RETURNS
Task<A>
Tesult of invoking the None() operation if the optional is in a None state, otherwise the bound Some(x) value is returned.
IfNone(A)
SUMMARY

Returns the noneValue if the optional is in a None state, otherwise the bound Some(x) value is returned.

PARAMETERS
noneValue
A
Value to return if in a None state
REMARKS
Will not accept a null noneValue
DECLARATION
[Pure]
public Task<A> IfNone(A noneValue)
RETURNS
Task<A>
noneValue if the optional is in a None state, otherwise the bound Some(x) value is returned
IfNoneUnsafe(Func<A>)
SUMMARY

Returns the result of invoking the None() operation if the optional is in a None state, otherwise the bound Some(x) value is returned.

PARAMETERS
None
Func<A>
Operation to invoke if the structure is in a None state
REMARKS
Will allow null the be returned from the None operation
DECLARATION
[Pure]
public Task<A> IfNoneUnsafe(Func<A> None)
RETURNS
Task<A>
Tesult of invoking the None() operation if the optional is in a None state, otherwise the bound Some(x) value is returned.
IfNoneUnsafe(Func<Task<A>>)
SUMMARY

Returns the result of invoking the None() operation if the optional is in a None state, otherwise the bound Some(x) value is returned.

PARAMETERS
None
Func<Task<A>>
Operation to invoke if the structure is in a None state
REMARKS
Will allow null the be returned from the None operation
DECLARATION
[Pure]
public Task<A> IfNoneUnsafe(Func<Task<A>> None)
RETURNS
Task<A>
Tesult of invoking the None() operation if the optional is in a None state, otherwise the bound Some(x) value is returned.
IfNoneUnsafe(A)
SUMMARY

Returns the noneValue if the optional is in a None state, otherwise the bound Some(x) value is returned.

PARAMETERS
noneValue
A
Value to return if in a None state
REMARKS
Will allow noneValue to be null
DECLARATION
[Pure]
public Task<A> IfNoneUnsafe(A noneValue)
RETURNS
Task<A>
noneValue if the optional is in a None state, otherwise the bound Some(x) value is returned
IfSome(Action<A>)
SUMMARY

Invokes the action if Option is in the Some state, otherwise nothing happens.

PARAMETERS
f
Action<A>
Action to invoke if Option is in the Some state
DECLARATION
public Task<Unit> IfSome(Action<A> f)
RETURNS
Task<Unit>
IfSome(Func<A, Task<Unit>>)
SUMMARY

Invokes the f function if Option is in the Some state, otherwise nothing happens.

PARAMETERS
f
Func<A, Task<Unit>>
Function to invoke if Option is in the Some state
DECLARATION
public Task<Unit> IfSome(Func<A, Task<Unit>> f)
RETURNS
Task<Unit>
IfSome(Func<A, Task>)
SUMMARY

Invokes the f function if Option is in the Some state, otherwise nothing happens.

PARAMETERS
f
Func<A, Task>
Function to invoke if Option is in the Some state
DECLARATION
public Task<Unit> IfSome(Func<A, Task> f)
RETURNS
Task<Unit>
IfSome(Func<A, Unit>)
SUMMARY

Invokes the f function if Option is in the Some state, otherwise nothing happens.

PARAMETERS
f
Func<A, Unit>
Function to invoke if Option is in the Some state
DECLARATION
public Task<Unit> IfSome(Func<A, Unit> f)
RETURNS
Task<Unit>
Iter(Action<A>)
SUMMARY

Invoke an action for the bound value (if in a Some state)

PARAMETERS
Some
Action<A>
Action to invoke
DECLARATION
[Pure]
public Task<Unit> Iter(Action<A> Some)
RETURNS
Task<Unit>
Join<B, C, D>(OptionAsync<B>, Func<A, C>, Func<B, C>, Func<A, B, D>)
SUMMARY

Monadic join

PARAMETERS
inner
OptionAsync<B>
outerKeyMap
Func<A, C>
innerKeyMap
Func<B, C>
project
Func<A, B, D>
DECLARATION
[Pure]
public OptionAsync<D> Join<B, C, D>(OptionAsync<B> inner, Func<A, C> outerKeyMap, Func<B, C> innerKeyMap, Func<A, B, D> project)
RETURNS
OptionAsync<D>
Map<B>(Func<A, B>)
SUMMARY

Projection from one value to another

PARAMETERS
f
Func<A, B>
Projection function
DECLARATION
[Pure]
public OptionAsync<B> Map<B>(Func<A, B> f)
RETURNS
OptionAsync<B>
Mapped functor
Map<B>(Func<A, Task<B>>)
SUMMARY

Projection from one value to another

PARAMETERS
f
Func<A, Task<B>>
Projection function
DECLARATION
[Pure]
public OptionAsync<B> Map<B>(Func<A, Task<B>> f)
RETURNS
OptionAsync<B>
Mapped functor
Match(Action<A>, Action)
SUMMARY

Match the two states of the Option

PARAMETERS
Some
Action<A>
Some match operation
None
Action
None match operation
DECLARATION
public Task<Unit> Match(Action<A> Some, Action None)
RETURNS
Task<Unit>
Match<B>(Func<A, B>, Func<B>)
SUMMARY

Match the two states of the Option and return a non-null R.

PARAMETERS
Some
Func<A, B>
Some match operation. Must not return null.
None
Func<B>
None match operation. Must not return null.
DECLARATION
[Pure]
public Task<B> Match<B>(Func<A, B> Some, Func<B> None)
RETURNS
Task<B>
A non-null B
Match<B>(Func<A, Task<B>>, Func<B>)
SUMMARY

Match the two states of the Option and return a non-null R.

PARAMETERS
Some
Func<A, Task<B>>
Some match operation. Must not return null.
None
Func<B>
None match operation. Must not return null.
DECLARATION
[Pure]
public Task<B> Match<B>(Func<A, Task<B>> Some, Func<B> None)
RETURNS
Task<B>
A non-null B
Match<B>(Func<A, B>, Func<Task<B>>)
SUMMARY

Match the two states of the Option and return a non-null R.

PARAMETERS
Some
Func<A, B>
Some match operation. Must not return null.
None
Func<Task<B>>
None match operation. Must not return null.
DECLARATION
[Pure]
public Task<B> Match<B>(Func<A, B> Some, Func<Task<B>> None)
RETURNS
Task<B>
A non-null B
Match<B>(Func<A, Task<B>>, Func<Task<B>>)
SUMMARY

Match the two states of the Option and return a non-null R.

PARAMETERS
Some
Func<A, Task<B>>
Some match operation. Must not return null.
None
Func<Task<B>>
None match operation. Must not return null.
DECLARATION
[Pure]
public Task<B> Match<B>(Func<A, Task<B>> Some, Func<Task<B>> None)
RETURNS
Task<B>
A non-null B
MatchUnsafe<B>(Func<A, B>, Func<B>)
SUMMARY

Match the two states of the Option and return a B, which can be null.

PARAMETERS
Some
Func<A, B>
Some match operation. May return null.
None
Func<B>
None match operation. May return null.
DECLARATION
[Pure]
public Task<B> MatchUnsafe<B>(Func<A, B> Some, Func<B> None)
RETURNS
Task<B>
B, or null
MatchUnsafe<B>(Func<A, Task<B>>, Func<B>)
SUMMARY

Match the two states of the Option and return a B, which can be null.

PARAMETERS
Some
Func<A, Task<B>>
Some match operation. May return null.
None
Func<B>
None match operation. May return null.
DECLARATION
[Pure]
public Task<B> MatchUnsafe<B>(Func<A, Task<B>> Some, Func<B> None)
RETURNS
Task<B>
B, or null
MatchUnsafe<B>(Func<A, B>, Func<Task<B>>)
SUMMARY

Match the two states of the Option and return a B, which can be null.

PARAMETERS
Some
Func<A, B>
Some match operation. May return null.
None
Func<Task<B>>
None match operation. May return null.
DECLARATION
[Pure]
public Task<B> MatchUnsafe<B>(Func<A, B> Some, Func<Task<B>> None)
RETURNS
Task<B>
B, or null
MatchUnsafe<B>(Func<A, Task<B>>, Func<Task<B>>)
SUMMARY

Match the two states of the Option and return a B, which can be null.

PARAMETERS
Some
Func<A, Task<B>>
Some match operation. May return null.
None
Func<Task<B>>
None match operation. May return null.
DECLARATION
[Pure]
public Task<B> MatchUnsafe<B>(Func<A, Task<B>> Some, Func<Task<B>> None)
RETURNS
Task<B>
B, or null
MatchUntyped<R>(Func<object, R>, Func<R>)
SUMMARY

Match operation with an untyped value for Some. This can be useful for serialisation and dealing with the IOptional interface

PARAMETERS
Some
Func<object, R>
Operation to perform if the option is in a Some state
None
Func<R>
Operation to perform if the option is in a None state
DECLARATION
[Pure]
public Task<R> MatchUntyped<R>(Func<object, R> Some, Func<R> None)
RETURNS
Task<R>
The result of the match operation
MatchUntyped<R>(Func<object, Task<R>>, Func<R>)
SUMMARY

Match operation with an untyped value for Some. This can be useful for serialisation and dealing with the IOptional interface

PARAMETERS
Some
Func<object, Task<R>>
Operation to perform if the option is in a Some state
None
Func<R>
Operation to perform if the option is in a None state
DECLARATION
[Pure]
public Task<R> MatchUntyped<R>(Func<object, Task<R>> Some, Func<R> None)
RETURNS
Task<R>
The result of the match operation
MatchUntyped<R>(Func<object, R>, Func<Task<R>>)
SUMMARY

Match operation with an untyped value for Some. This can be useful for serialisation and dealing with the IOptional interface

PARAMETERS
Some
Func<object, R>
Operation to perform if the option is in a Some state
None
Func<Task<R>>
Operation to perform if the option is in a None state
DECLARATION
[Pure]
public Task<R> MatchUntyped<R>(Func<object, R> Some, Func<Task<R>> None)
RETURNS
Task<R>
The result of the match operation
MatchUntyped<R>(Func<object, Task<R>>, Func<Task<R>>)
SUMMARY

Match operation with an untyped value for Some. This can be useful for serialisation and dealing with the IOptional interface

PARAMETERS
Some
Func<object, Task<R>>
Operation to perform if the option is in a Some state
None
Func<Task<R>>
Operation to perform if the option is in a None state
DECLARATION
[Pure]
public Task<R> MatchUntyped<R>(Func<object, Task<R>> Some, Func<Task<R>> None)
RETURNS
Task<R>
The result of the match operation
ParMap<B, C, D>(Func<A, B, C, D>)
SUMMARY

Partial application map

PARAMETERS
func
Func<A, B, C, D>
REMARKS
TODO: Better documentation of this function
DECLARATION
[Pure]
public OptionAsync<Func<B, Func<C, D>>> ParMap<B, C, D>(Func<A, B, C, D> func)
RETURNS
OptionAsync<Func<B, Func<C, D>>>
ParMap<B, C>(Func<A, B, C>)
SUMMARY

Partial application map

PARAMETERS
func
Func<A, B, C>
REMARKS
TODO: Better documentation of this function
DECLARATION
[Pure]
public OptionAsync<Func<B, C>> ParMap<B, C>(Func<A, B, C> func)
RETURNS
OptionAsync<Func<B, C>>
Select<B>(Func<A, B>)
SUMMARY

Projection from one value to another

PARAMETERS
f
Func<A, B>
Projection function
DECLARATION
[Pure]
public OptionAsync<B> Select<B>(Func<A, B> f)
RETURNS
OptionAsync<B>
Mapped functor
SelectMany<B, C>(Func<A, OptionAsync<B>>, Func<A, B, C>)
SUMMARY

Monad bind operation

PARAMETERS
bind
Func<A, OptionAsync<B>>
project
Func<A, B, C>
DECLARATION
[Pure]
public OptionAsync<C> SelectMany<B, C>(Func<A, OptionAsync<B>> bind, Func<A, B, C> project)
RETURNS
OptionAsync<C>
Some(A)
SUMMARY

Construct an Option of A in a Some state

PARAMETERS
value
A
Value to bind, must be non-null
DECLARATION
[Pure]
public static OptionAsync<A> Some(A value)
RETURNS
OptionAsync<A>
Option of A
ToArray()
SUMMARY

Convert the Option to an enumerable of zero or one items

DECLARATION
[Pure]
public Task<Arr<A>> ToArray()
RETURNS
Task<Arr<A>>
An enumerable of zero or one items
ToEither<L>(L)
SUMMARY

Convert the structure to an Either

PARAMETERS
defaultLeftValue
L
Default value if the structure is in a None state
DECLARATION
[Pure]
public Task<Either<L, A>> ToEither<L>(L defaultLeftValue)
RETURNS
Task<Either<L, A>>
An Either representation of the structure
ToEither<L>(Func<L>)
SUMMARY

Convert the structure to an Either

PARAMETERS
Left
Func<L>
DECLARATION
[Pure]
public Task<Either<L, A>> ToEither<L>(Func<L> Left)
RETURNS
Task<Either<L, A>>
An Either representation of the structure
ToEitherUnsafe<L>(L)
SUMMARY

Convert the structure to an EitherUnsafe

PARAMETERS
defaultLeftValue
L
Default value if the structure is in a None state
DECLARATION
[Pure]
public Task<EitherUnsafe<L, A>> ToEitherUnsafe<L>(L defaultLeftValue)
RETURNS
Task<EitherUnsafe<L, A>>
An EitherUnsafe representation of the structure
ToEitherUnsafe<L>(Func<L>)
SUMMARY

Convert the structure to an EitherUnsafe

PARAMETERS
Left
Func<L>
DECLARATION
[Pure]
public Task<EitherUnsafe<L, A>> ToEitherUnsafe<L>(Func<L> Left)
RETURNS
Task<EitherUnsafe<L, A>>
An EitherUnsafe representation of the structure
ToList()
SUMMARY

Convert the Option to an immutable list of zero or one items

DECLARATION
[Pure]
public Task<Lst<A>> ToList()
RETURNS
Task<Lst<A>>
An immutable list of zero or one items
ToOption()
SUMMARY

Convert the structure to a Option

DECLARATION
[Pure]
public Task<Option<A>> ToOption()
RETURNS
Task<Option<A>>
An Option representation of the structure
ToOptionUnsafe()
SUMMARY

Convert the structure to a OptionUnsafe

DECLARATION
[Pure]
public Task<OptionUnsafe<A>> ToOptionUnsafe()
RETURNS
Task<OptionUnsafe<A>>
An OptionUnsafe representation of the structure
ToSeq()
SUMMARY

Convert the Option to an enumerable sequence of zero or one items

DECLARATION
[Pure]
public Task<Seq<A>> ToSeq()
RETURNS
Task<Seq<A>>
An enumerable sequence of zero or one items
ToString()
SUMMARY

Get a string representation of the Option

DECLARATION
[Pure]
public override string ToString()
RETURNS
string
String representation of the Option
ToTry()
SUMMARY

Convert the structure to a TryAsync

DECLARATION
[Pure]
public TryAsync<A> ToTry()
RETURNS
TryAsync<A>
A TryAsync representation of the structure
ToTryOption()
SUMMARY

Convert the structure to a TryOptionAsync

DECLARATION
[Pure]
public TryOptionAsync<A> ToTryOption()
RETURNS
TryOptionAsync<A>
A TryOptionAsync representation of the structure
Where(Func<A, bool>)
SUMMARY

Apply a predicate to the bound value (if in a Some state)

PARAMETERS
pred
Func<A, bool>
Predicate to apply
DECLARATION
[Pure]
public OptionAsync<A> Where(Func<A, bool> pred)
RETURNS
OptionAsync<A>
Some(x) if the Option is in a Some state and the predicate returns True. None otherwise.