- OptionAsyncAwaiter <A>
- OptionAsync <A>
- None = new ((false, default(A)).AsTask())
- Some (A value)
- SomeAsync (Task<A> value)
- Optional (A? value)
- OptionalAsync (Task<A?> value)
- OptionAsync (IEnumerable<A?> option)
- Case
- | (OptionAsync<A> lhs, OptionAsync<A> rhs)
- Equals <EqA> (OptionAsync<A> rhs)
- Equals (object _)
- Equals (OptionAsync<A> rhs)
- == (OptionAsync<A> lhs, OptionAsync<A> rhs)
- != (OptionAsync<A> lhs, OptionAsync<A> rhs)
- CompareTo <OrdA> (OptionAsync<A> rhs)
- CompareTo (OptionAsync<A> rhs)
- < (OptionAsync<A> lhs, OptionAsync<A> rhs)
- <= (OptionAsync<A> lhs, OptionAsync<A> rhs)
- > (OptionAsync<A> lhs, OptionAsync<A> rhs)
- >= (OptionAsync<A> lhs, OptionAsync<A> rhs)
- GetHashCode ()
- GetHashCodeAsync ()
- ToString ()
- ToStringAsync ()
- IsSome
- IsNone
- Value
- Do (Action<A> f)
- Select <B> (Func<A, B> f)
- Map <B> (Func<A, B> f)
- MapAsync <B> (Func<A, Task<B>> f)
- Bind <B> (Func<A, OptionAsync<B>> f)
- BindAsync <B> (Func<A, Task<OptionAsync<B>>> f)
- SelectMany <B, C> ( Func<A, OptionAsync<B>> bind, Func<A, B, C> project)
- MatchUntyped <R> (Func<object, R> Some, Func<R> None)
- MatchUntyped <R> (Func<object, Task<R>> Some, Func<R> None)
- MatchUntypedAsync <R> (Func<object, R> Some, Func<Task<R>> None)
- MatchUntypedAsync <R> (Func<object, Task<R>> Some, Func<Task<R>> None)
- GetUnderlyingType ()
- ToArray ()
- ToList ()
- ToSeq ()
- AsEnumerable ()
- ToAff ()
- ToAff (Error Fail)
- ToEither <L> (L defaultLeftValue)
- ToEither <L> (Func<L> Left)
- ToEitherUnsafe <L> (L defaultLeftValue)
- ToEitherUnsafe <L> (Func<L> Left)
- ToOption ()
- ToOptionUnsafe ()
- ToTryOption ()
- ToTry ()
- Some (Action<A> f)
- Some <B> (Func<A, B> f)
- Match <B> (Func<A, B> Some, Func<B> None)
- MatchAsync <B> (Func<A, Task<B>> Some, Func<B> None)
- MatchAsync <B> (Func<A, B> Some, Func<Task<B>> None)
- MatchAsync <B> (Func<A, Task<B>> Some, Func<Task<B>> None)
- MatchUnsafe <B> (Func<A, B> Some, Func<B> None)
- MatchUnsafeAsync <B> (Func<A, Task<B>> Some, Func<B> None)
- MatchUnsafeAsync <B> (Func<A, B> Some, Func<Task<B>> None)
- MatchUnsafeAsync <B> (Func<A, Task<B>> Some, Func<Task<B>> None)
- Match (Action<A> Some, Action None)
- IfSome (Func<A, Task> f)
- IfSome (Action<A> f)
- IfSomeAsync (Func<A, Task<Unit>> f)
- IfSomeAsync (Func<A, Task> f)
- IfSome (Func<A, Unit> f)
- IfNone (Func<A> None)
- IfNoneAsync (Func<Task<A>> None)
- IfNone (A noneValue)
- IfNoneUnsafe (Func<A> None)
- IfNoneUnsafeAsync (Func<Task<A>> None)
- IfNoneUnsafe (A noneValue)
- Fold <S> (S state, Func<S, A, S> folder)
- FoldAsync <S> (S state, Func<S, A, Task<S>> folder)
- FoldBack <S> (S state, Func<S, A, S> folder)
- FoldBackAsync <S> (S state, Func<S, A, Task<S>> folder)
- BiFold <S> (S state, Func<S, A, S> Some, Func<S, Unit, S> None)
- BiFold <S> (S state, Func<S, A, Task<S>> Some, Func<S, Unit, S> None)
- BiFoldAsync <S> (S state, Func<S, A, S> Some, Func<S, Unit, Task<S>> None)
- BiFoldAsync <S> (S state, Func<S, A, Task<S>> Some, Func<S, Unit, Task<S>> None)
- BiFold <S> (S state, Func<S, A, S> Some, Func<S, S> None)
- BiFoldAsync <S> (S state, Func<S, A, Task<S>> Some, Func<S, S> None)
- BiFoldAsync <S> (S state, Func<S, A, S> Some, Func<S, Task<S>> None)
- BiFoldAsync <S> (S state, Func<S, A, Task<S>> Some, Func<S, Task<S>> None)
- BiMap <B> (Func<A, B> Some, Func<Unit, B> None)
- BiMap <B> (Func<A, B> Some, Func<B> None)
- Count ()
- ForAll (Func<A, bool> pred)
- ForAllAsync (Func<A, Task<bool>> pred)
- BiForAll (Func<A, bool> Some, Func<Unit, bool> None)
- BiForAll (Func<A, bool> Some, Func<bool> None)
- Exists (Func<A, bool> pred)
- ExistsAsync (Func<A, Task<bool>> pred)
- BiExists (Func<A, bool> Some, Func<Unit, bool> None)
- BiExists (Func<A, bool> Some, Func<bool> None)
- Iter (Action<A> Some)
- Iter (Func<A, Task<Unit>> Some)
- BiIter (Action<A> Some, Action<Unit> None)
- BiIter (Action<A> Some, Action None)
- Filter (Func<A, bool> pred)
- FilterAsync (Func<A, Task<bool>> pred)
- Where (Func<A, bool> pred)
- Where (Func<A, Task<bool>> pred)
- Join <B, C, D> ( OptionAsync<B> inner, Func<A, C> outerKeyMap, Func<B, C> innerKeyMap, Func<A, B, D> project)
- Join <B, C, D> ( OptionAsync<B> inner, Func<A, C> outerKeyMap, Func<B, C> innerKeyMap, Func<A, B, Task<D>> project)
- Join <B, C, D> ( OptionAsync<B> inner, Func<A, Task<C>> outerKeyMap, Func<B, Task<C>> innerKeyMap, Func<A, B, Task<D>> project)
- Join <B, C, D> ( OptionAsync<B> inner, Func<A, Task<C>> outerKeyMap, Func<B, Task<C>> innerKeyMap, Func<A, B, D> project)
- ParMap <B, C> (Func<A, B, C> func)
- ParMap <B, C, D> (Func<A, B, C, D> func)
- GetAsyncEnumerator (CancellationToken cancellationToken = default)
- OptionAsyncExtensions
- Flatten <A> (this OptionAsync<OptionAsync<A>> ma)
- Somes <A> (this IEnumerable<OptionAsync<A>> self)
- Somes <A> (this Seq<OptionAsync<A>> self)
- Add <ARITH, A> (this OptionAsync<A> x, OptionAsync<A> y)
- Subtract <ARITH, A> (this OptionAsync<A> x, OptionAsync<A> y)
- Product <ARITH, A> (this OptionAsync<A> x, OptionAsync<A> y)
- Divide <NUM, A> (this OptionAsync<A> x, OptionAsync<A> y)
- Apply <A, B> (this OptionAsync<Func<A, B>> fab, OptionAsync<A> fa)
- Apply <A, B> (this Func<A, B> fab, OptionAsync<A> fa)
- Apply <A, B, C> (this OptionAsync<Func<A, B, C>> fabc, OptionAsync<A> fa, OptionAsync<B> fb)
- Apply <A, B, C> (this Func<A, B, C> fabc, OptionAsync<A> fa, OptionAsync<B> fb)
- Apply <A, B, C> (this OptionAsync<Func<A, B, C>> fabc, OptionAsync<A> fa)
- Apply <A, B, C> (this Func<A, B, C> fabc, OptionAsync<A> fa)
- Apply <A, B, C> (this OptionAsync<Func<A, Func<B, C>>> fabc, OptionAsync<A> fa)
- Apply <A, B, C> (this Func<A, Func<B, C>> fabc, OptionAsync<A> fa)
- Action <A, B> (this OptionAsync<A> fa, OptionAsync<B> fb)
- ToNullable <A> (this OptionAsync<A> ma)
- Match <T, R> (this IEnumerable<OptionAsync<T>> list, Func<T, IEnumerable<R>> Some, Func<IEnumerable<R>> None )
- Match <T, R> (this IEnumerable<OptionAsync<T>> list, Func<T, IEnumerable<R>> Some, IEnumerable<R> None)
- Sum (this OptionAsync<int> a)
- Sum <NUM, A> (this OptionAsync<A> self)
- OptionAsyncMethodBuilder <A>
- Create ()
- Start <TStateMachine> (ref TStateMachine machine)
- SetStateMachine (IAsyncStateMachine machine)
- SetException (Exception _)
- SetResult (A result)
- AwaitOnCompleted <TAwaiter, TStateMachine> (ref TAwaiter awaiter, ref TStateMachine machine)
- AwaitUnsafeOnCompleted <TAwaiter, TStateMachine> (ref TAwaiter awaiter, ref TStateMachine machine)
- Task
- Prelude
- flatten <A> (OptionAsync<OptionAsync<A>> ma)
- subtract <NUM, T> (OptionAsync<T> lhs, OptionAsync<T> rhs)
- product <NUM, T> (OptionAsync<T> lhs, OptionAsync<T> rhs)
- divide <NUM, T> (OptionAsync<T> lhs, OptionAsync<T> rhs)
- add <NUM, T> (OptionAsync<T> lhs, OptionAsync<T> rhs)
- isSome <T> (OptionAsync<T> value)
- isNone <T> (OptionAsync<T> value)
- SomeAsync <T> (T value)
- SomeAsync <T> (Task<T> taskValue)
- SomeValueAsync <A> (Task<A> taskValue)
- SomeAsync <T> (Func<Unit, Task<T>> f)
- SomeAsync <T> (Func<Task<T>> f)
- SomeAsync <T> (T? value)
- OptionalAsync <T> (Task<T?> value)
- OptionalAsync <T> (Func<Unit, Task<T?>> f)
- OptionalAsync <T> (T? value)
- ifSome <T> (OptionAsync<T> OptionAsync, Action<T> Some)
- ifNone <T> (OptionAsync<T> ma, Func<T> None)
- ifNone <T> (OptionAsync<T> ma, T noneValue)
- ifNoneUnsafe <T> (OptionAsync<T> ma, Func<T> None)
- ifNoneUnsafe <T> (OptionAsync<T> ma, T noneValue)
- match <T, R> (OptionAsync<T> ma, Func<T, R> Some, Func<R> None)
- matchAsync <T, R> (OptionAsync<T> ma, Func<T, Task<R>> Some, Func<R> None)
- matchAsync <T, R> (OptionAsync<T> ma, Func<T, R> Some, Func<Task<R>> None)
- matchAsync <T, R> (OptionAsync<T> ma, Func<T, Task<R>> Some, Func<Task<R>> None)
- matchUnsafe <T, R> (OptionAsync<T> ma, Func<T, R> Some, Func<R> None)
- matchUnsafeAsync <T, R> (OptionAsync<T> ma, Func<T, Task<R>> Some, Func<R> None)
- matchUnsafeAsync <T, R> (OptionAsync<T> ma, Func<T, R> Some, Func<Task<R>> None)
- matchUnsafeAsync <T, R> (OptionAsync<T> ma, Func<T, Task<R>> Some, Func<Task<R>> None)
- match <T> (OptionAsync<T> ma, Action<T> Some, Action None)
- apply <A, B> (OptionAsync<Func<A, B>> fab, OptionAsync<A> fa)
- apply <A, B> (Func<A, B> fab, OptionAsync<A> fa)
- apply <A, B, C> (OptionAsync<Func<A, B, C>> fabc, OptionAsync<A> fa, OptionAsync<B> fb)
- apply <A, B, C> (Func<A, B, C> fabc, OptionAsync<A> fa, OptionAsync<B> fb)
- apply <A, B, C> (OptionAsync<Func<A, B, C>> fabc, OptionAsync<A> fa)
- apply <A, B, C> (Func<A, B, C> fabc, OptionAsync<A> fa)
- apply <A, B, C> (OptionAsync<Func<A, Func<B, C>>> fabc, OptionAsync<A> fa)
- apply <A, B, C> (Func<A, Func<B, C>> fabc, OptionAsync<A> fa)
- action <A, B> (OptionAsync<A> fa, OptionAsync<B> fb)
- fold <S, A> (OptionAsync<A> ma, S state, Func<S, A, S> folder)
- fold <S, A> (OptionAsync<A> ma, S state, Func<S, A, Task<S>> folder)
- bifold <S, A> (OptionAsync<A> ma, S state, Func<S, A, S> Some, Func<S, S> None)
- bifold <S, A> (OptionAsync<A> ma, S state, Func<S, A, Task<S>> Some, Func<S, S> None)
- bifold <S, A> (OptionAsync<A> ma, S state, Func<S, A, S> Some, Func<S, Task<S>> None)
- bifold <S, A> (OptionAsync<A> ma, S state, Func<S, A, Task<S>> Some, Func<S, Task<S>> None)
- bifold <S, A> (OptionAsync<A> ma, S state, Func<S, A, S> Some, Func<S, Unit, S> None)
- bifold <S, A> (OptionAsync<A> ma, S state, Func<S, A, Task<S>> Some, Func<S, Unit, S> None)
- bifold <S, A> (OptionAsync<A> ma, S state, Func<S, A, S> Some, Func<S, Unit, Task<S>> None)
- bifold <S, A> (OptionAsync<A> ma, S state, Func<S, A, Task<S>> Some, Func<S, Unit, Task<S>> None)
- forall <A> (OptionAsync<A> ma, Func<A, bool> pred)
- biforall <A> (OptionAsync<A> ma, Func<A, bool> Some, Func<Unit, bool> None)
- biforall <A> (OptionAsync<A> ma, Func<A, bool> Some, Func<bool> None)
- count <A> (OptionAsync<A> ma)
- exists <A> (OptionAsync<A> ma, Func<A, bool> pred)
- biexists <A> (OptionAsync<A> ma, Func<A, bool> Some, Func<Unit, bool> None)
- biexists <A> (OptionAsync<A> ma, Func<A, bool> Some, Func<bool> None)
- map <A, B> (OptionAsync<A> ma, Func<A, B> f)
- bimap <A, B> (OptionAsync<A> ma, Func<A, B> Some, Func<B> None)
- bimap <A, B> (OptionAsync<A> ma, Func<A, B> Some, Func<Unit, B> None)
- parmap <T1, T2, R> (OptionAsync<T1> ma, Func<T1, T2, R> mapper)
- parmap <T1, T2, T3, R> (OptionAsync<T1> ma, Func<T1, T2, T3, R> mapper)
- filter <T> (OptionAsync<T> ma, Func<T, bool> pred)
- bind <T, R> (OptionAsync<T> ma, Func<T, OptionAsync<R>> binder)
- match <T, R> (IEnumerable<OptionAsync<T>> list, Func<T, IEnumerable<R>> Some, Func<IEnumerable<R>> None )
- match <T, R> (IEnumerable<OptionAsync<T>> list, Func<T, IEnumerable<R>> Some, IEnumerable<R> None)
- somes <T> (IEnumerable<OptionAsync<T>> list)
- toList <T> (OptionAsync<T> OptionAsync)
- toArray <T> (OptionAsync<T> OptionAsync)
- SomeAsyncContext <OPT, OA, A, B>
- SomeAsyncUnitContext <OPT, OA, A>
struct OptionAsync <A> Source #
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
type | A | Bound value |
field OptionAsync<A> None = new ((false, default(A)).AsTask()) Source #
None
constructor OptionAsync (IEnumerable<A?> option) Source #
Ctor that facilitates serialisation
param | option | None or Some A. |
method OptionAsync<A> Some (A value) Source #
Construct an OptionAsync of A in a Some state
param | value | Value to bind, must be non-null |
returns | OptionAsync of A |
method OptionAsync<A> SomeAsync (Task<A> value) Source #
Construct an OptionAsync of A in a Some state
param | value | Value to bind, must be non-null |
returns | OptionAsync of A |
method OptionAsync<A> Optional (A? value) Source #
Construct an OptionAsync of A in a Some state
param | value | Value to bind, must be non-null |
returns | OptionAsync of A |
method OptionAsync<A> OptionalAsync (Task<A?> value) Source #
Construct an OptionAsync of A in a Some state
param | value | Value to bind, must be non-null |
returns | OptionAsync of A |
method Task<bool> Equals <EqA> (OptionAsync<A> rhs) Source #
Equality operator
method Task<int> CompareTo <OrdA> (OptionAsync<A> rhs) Source #
Ordering
method int GetHashCode () Source #
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
returns | Hash-code from the bound value, unless the Option is in a None state, in which case the hash-code will be 0 |
method Task<int> GetHashCodeAsync () Source #
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
returns | Hash-code from the bound value, unless the Option is in a None state, in which case the hash-code will be 0 |
method string ToString () Source #
Get a string representation of the Option
returns | String representation of the Option |
method Task<string> ToStringAsync () Source #
Get a string representation of the Option
returns | String representation of the Option |
method OptionAsync<A> Do (Action<A> f) Source #
Impure iteration of the bound value in the structure
returns | Returns the original unmodified structure |
method OptionAsync<B> Select <B> (Func<A, B> f) Source #
Projection from one value to another
type | B | Resulting functor value type |
param | f | Projection function |
returns | Mapped functor |
method OptionAsync<B> Map <B> (Func<A, B> f) Source #
Projection from one value to another
type | B | Resulting functor value type |
param | f | Projection function |
returns | Mapped functor |
method OptionAsync<B> MapAsync <B> (Func<A, Task<B>> f) Source #
Projection from one value to another
type | B | Resulting functor value type |
param | f | Projection function |
returns | Mapped functor |
method OptionAsync<C> SelectMany <B, C> ( Func<A, OptionAsync<B>> bind, Func<A, B, C> project) Source #
Monad bind operation
method Task<R> MatchUntyped <R> (Func<object, R> Some, Func<R> None) Source #
Match operation with an untyped value for Some. This can be useful for serialisation and dealing with the IOptional interface
type | R | The return type |
param | Some | Operation to perform if the option is in a Some state |
param | None | Operation to perform if the option is in a None state |
returns | The result of the match operation |
method Task<R> MatchUntyped <R> (Func<object, Task<R>> Some, Func<R> None) Source #
Match operation with an untyped value for Some. This can be useful for serialisation and dealing with the IOptional interface
type | R | The return type |
param | Some | Operation to perform if the option is in a Some state |
param | None | Operation to perform if the option is in a None state |
returns | The result of the match operation |
method Task<R> MatchUntypedAsync <R> (Func<object, R> Some, Func<Task<R>> None) Source #
Match operation with an untyped value for Some. This can be useful for serialisation and dealing with the IOptional interface
type | R | The return type |
param | Some | Operation to perform if the option is in a Some state |
param | None | Operation to perform if the option is in a None state |
returns | The result of the match operation |
method Task<R> MatchUntypedAsync <R> (Func<object, Task<R>> Some, Func<Task<R>> None) Source #
Match operation with an untyped value for Some. This can be useful for serialisation and dealing with the IOptional interface
type | R | The return type |
param | Some | Operation to perform if the option is in a Some state |
param | None | Operation to perform if the option is in a None state |
returns | The result of the match operation |
method Type GetUnderlyingType () Source #
Get the Type of the bound value
returns | Type of the bound value |
method Task<Arr<A>> ToArray () Source #
Convert the Option to an enumerable of zero or one items
returns | An enumerable of zero or one items |
method Task<Lst<A>> ToList () Source #
Convert the Option to an immutable list of zero or one items
returns | An immutable list of zero or one items |
method Task<Seq<A>> ToSeq () Source #
Convert the Option to an enumerable sequence of zero or one items
returns | An enumerable sequence of zero or one items |
method Task<IEnumerable<A>> AsEnumerable () Source #
Convert the Option to an enumerable of zero or one items
returns | An enumerable of zero or one items |
method Aff<A> ToAff () Source #
Convert the structure to an Aff
returns | An Aff representation of the structure |
method Aff<A> ToAff (Error Fail) Source #
Convert the structure to an Aff
param | Fail | Default value if the structure is in a None state |
returns | An Aff representation of the structure |
method EitherAsync<L, A> ToEither <L> (L defaultLeftValue) Source #
Convert the structure to an Either
param | defaultLeftValue | Default value if the structure is in a None state |
returns | An Either representation of the structure |
method EitherAsync<L, A> ToEither <L> (Func<L> Left) Source #
Convert the structure to an Either
param | defaultLeftValue | Function to invoke to get a default value if the structure is in a None state |
returns | An Either representation of the structure |
method Task<EitherUnsafe<L, A>> ToEitherUnsafe <L> (L defaultLeftValue) Source #
Convert the structure to an EitherUnsafe
param | defaultLeftValue | Default value if the structure is in a None state |
returns | An EitherUnsafe representation of the structure |
method Task<EitherUnsafe<L, A>> ToEitherUnsafe <L> (Func<L> Left) Source #
Convert the structure to an EitherUnsafe
param | defaultLeftValue | Function to invoke to get a default value if the structure is in a None state |
returns | An EitherUnsafe representation of the structure |
method Task<Option<A>> ToOption () Source #
Convert the structure to a Option
returns | An Option representation of the structure |
method Task<OptionUnsafe<A>> ToOptionUnsafe () Source #
Convert the structure to a OptionUnsafe
returns | An OptionUnsafe representation of the structure |
method TryOptionAsync<A> ToTryOption () Source #
Convert the structure to a TryOptionAsync
returns | A TryOptionAsync representation of the structure |
method TryAsync<A> ToTry () Source #
Convert the structure to a TryAsync
returns | A TryAsync representation of the structure |
method SomeAsyncUnitContext<MOptionAsync<A>, OptionAsync<A>, A> Some (Action<A> f) Source #
Fluent pattern matching. Provide a Some handler and then follow on fluently with .None(...) to complete the matching operation. This is for dispatching actions, use Some<A,B>(...) to return a value from the match operation.
param | f | The Some(x) match operation |
method SomeAsyncContext<MOptionAsync<A>, OptionAsync<A>, A, B> Some <B> (Func<A, B> f) Source #
Fluent pattern matching. Provide a Some handler and then follow on fluently with .None(...) to complete the matching operation. This is for returning a value from the match operation, to dispatch an action instead, use Some(...)
type | B | Match operation return value type |
param | f | The Some(x) match operation |
returns | The result of the match operation |
method Task<B> Match <B> (Func<A, B> Some, Func<B> None) Source #
Match the two states of the Option and return a non-null R.
type | B | Return type |
param | Some | Some match operation. Must not return null. |
param | None | None match operation. Must not return null. |
returns | A non-null B |
method Task<B> MatchAsync <B> (Func<A, Task<B>> Some, Func<B> None) Source #
Match the two states of the Option and return a non-null R.
type | B | Return type |
param | Some | Some match operation. Must not return null. |
param | None | None match operation. Must not return null. |
returns | A non-null B |
method Task<B> MatchAsync <B> (Func<A, B> Some, Func<Task<B>> None) Source #
Match the two states of the Option and return a non-null R.
type | B | Return type |
param | Some | Some match operation. Must not return null. |
param | None | None match operation. Must not return null. |
returns | A non-null B |
method Task<B> MatchAsync <B> (Func<A, Task<B>> Some, Func<Task<B>> None) Source #
Match the two states of the Option and return a non-null R.
type | B | Return type |
param | Some | Some match operation. Must not return null. |
param | None | None match operation. Must not return null. |
returns | A non-null B |
method Task<B> MatchUnsafe <B> (Func<A, B> Some, Func<B> None) Source #
Match the two states of the Option and return a B, which can be null.
type | B | Return type |
param | Some | Some match operation. May return null. |
param | None | None match operation. May return null. |
returns | B, or null |
method Task<B> MatchUnsafeAsync <B> (Func<A, Task<B>> Some, Func<B> None) Source #
Match the two states of the Option and return a B, which can be null.
type | B | Return type |
param | Some | Some match operation. May return null. |
param | None | None match operation. May return null. |
returns | B, or null |
method Task<B> MatchUnsafeAsync <B> (Func<A, B> Some, Func<Task<B>> None) Source #
Match the two states of the Option and return a B, which can be null.
type | B | Return type |
param | Some | Some match operation. May return null. |
param | None | None match operation. May return null. |
returns | B, or null |
method Task<B> MatchUnsafeAsync <B> (Func<A, Task<B>> Some, Func<Task<B>> None) Source #
Match the two states of the Option and return a B, which can be null.
type | B | Return type |
param | Some | Some match operation. May return null. |
param | None | None match operation. May return null. |
returns | B, or null |
method Task<Unit> Match (Action<A> Some, Action None) Source #
Match the two states of the Option
param | Some | Some match operation |
param | None | None match operation |
method Task<Unit> IfSome (Func<A, Task> f) Source #
Invokes the action if Option is in the Some state, otherwise nothing happens.
param | f | async Action to invoke if Option is in the Some state |
method Task<Unit> IfSome (Action<A> f) Source #
Invokes the action if Option is in the Some state, otherwise nothing happens.
param | f | Action to invoke if Option is in the Some state |
method Task<Unit> IfSomeAsync (Func<A, Task<Unit>> f) Source #
Invokes the f function if Option is in the Some state, otherwise nothing happens.
param | f | Function to invoke if Option is in the Some state |
method Task<Unit> IfSomeAsync (Func<A, Task> f) Source #
Invokes the f function if Option is in the Some state, otherwise nothing happens.
param | f | Function to invoke if Option is in the Some state |
method Task<Unit> IfSome (Func<A, Unit> f) Source #
Invokes the f function if Option is in the Some state, otherwise nothing happens.
param | f | Function to invoke if Option is in the Some state |
method Task<A> IfNone (Func<A> None) Source #
Returns the result of invoking the None() operation if the optional is in a None state, otherwise the bound Some(x) value is returned.
Will not accept a null return value from the None operation
param | None | Operation to invoke if the structure is in a None state |
returns | Tesult of invoking the None() operation if the optional is in a None state, otherwise the bound Some(x) value is returned. |
method Task<A> IfNoneAsync (Func<Task<A>> None) Source #
Returns the result of invoking the None() operation if the optional is in a None state, otherwise the bound Some(x) value is returned.
Will not accept a null return value from the None operation
param | None | Operation to invoke if the structure is in a None state |
returns | Tesult of invoking the None() operation if the optional is in a None state, otherwise the bound Some(x) value is returned. |
method Task<A> IfNone (A noneValue) Source #
Returns the noneValue if the optional is in a None state, otherwise the bound Some(x) value is returned.
Will not accept a null noneValue
param | noneValue | Value to return if in a None state |
returns | noneValue if the optional is in a None state, otherwise the bound Some(x) value is returned |
method Task<A> IfNoneUnsafe (Func<A> None) Source #
Returns the result of invoking the None() operation if the optional is in a None state, otherwise the bound Some(x) value is returned.
Will allow null the be returned from the None operation
param | None | Operation to invoke if the structure is in a None state |
returns | Tesult of invoking the None() operation if the optional is in a None state, otherwise the bound Some(x) value is returned. |
method Task<A> IfNoneUnsafeAsync (Func<Task<A>> None) Source #
Returns the result of invoking the None() operation if the optional is in a None state, otherwise the bound Some(x) value is returned.
Will allow null the be returned from the None operation
param | None | Operation to invoke if the structure is in a None state |
returns | Tesult of invoking the None() operation if the optional is in a None state, otherwise the bound Some(x) value is returned. |
method Task<A> IfNoneUnsafe (A noneValue) Source #
Returns the noneValue if the optional is in a None state, otherwise the bound Some(x) value is returned.
Will allow noneValue to be null
param | noneValue | Value to return if in a None state |
returns | noneValue if the optional is in a None state, otherwise the bound Some(x) value is returned |
method Task<S> Fold <S> (S state, Func<S, A, S> folder) Source #
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.
type | S | Aggregate state type |
param | state | Initial state |
param | folder | Folder function, applied if Option is in a Some state |
returns | The aggregate state |
method Task<S> FoldAsync <S> (S state, Func<S, A, Task<S>> folder) Source #
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.
type | S | Aggregate state type |
param | state | Initial state |
param | folder | Folder function, applied if Option is in a Some state |
returns | The aggregate state |
method Task<S> FoldBack <S> (S state, Func<S, A, S> folder) Source #
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.
type | S | Aggregate state type |
param | state | Initial state |
param | folder | Folder function, applied if Option is in a Some state |
returns | The aggregate state |
method Task<S> FoldBackAsync <S> (S state, Func<S, A, Task<S>> folder) Source #
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.
type | S | Aggregate state type |
param | state | Initial state |
param | folder | Folder function, applied if Option is in a Some state |
returns | The aggregate state |
method Task<S> BiFold <S> (S state, Func<S, A, S> Some, Func<S, Unit, S> None) Source #
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.
type | S | Aggregate state type |
param | state | Initial state |
param | Some | Folder function, applied if Option is in a Some state |
param | None | Folder function, applied if Option is in a None state |
returns | The aggregate state |
method Task<S> BiFold <S> (S state, Func<S, A, Task<S>> Some, Func<S, Unit, S> None) Source #
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.
type | S | Aggregate state type |
param | state | Initial state |
param | Some | Folder function, applied if Option is in a Some state |
param | None | Folder function, applied if Option is in a None state |
returns | The aggregate state |
method Task<S> BiFoldAsync <S> (S state, Func<S, A, S> Some, Func<S, Unit, Task<S>> None) Source #
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.
type | S | Aggregate state type |
param | state | Initial state |
param | Some | Folder function, applied if Option is in a Some state |
param | None | Folder function, applied if Option is in a None state |
returns | The aggregate state |
method Task<S> BiFoldAsync <S> (S state, Func<S, A, Task<S>> Some, Func<S, Unit, Task<S>> None) Source #
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.
type | S | Aggregate state type |
param | state | Initial state |
param | Some | Folder function, applied if Option is in a Some state |
param | None | Folder function, applied if Option is in a None state |
returns | The aggregate state |
method Task<S> BiFold <S> (S state, Func<S, A, S> Some, Func<S, S> None) Source #
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.
type | S | Aggregate state type |
param | state | Initial state |
param | Some | Folder function, applied if Option is in a Some state |
param | None | Folder function, applied if Option is in a None state |
returns | The aggregate state |
method Task<S> BiFoldAsync <S> (S state, Func<S, A, Task<S>> Some, Func<S, S> None) Source #
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.
type | S | Aggregate state type |
param | state | Initial state |
param | Some | Folder function, applied if Option is in a Some state |
param | None | Folder function, applied if Option is in a None state |
returns | The aggregate state |
method Task<S> BiFoldAsync <S> (S state, Func<S, A, S> Some, Func<S, Task<S>> None) Source #
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.
type | S | Aggregate state type |
param | state | Initial state |
param | Some | Folder function, applied if Option is in a Some state |
param | None | Folder function, applied if Option is in a None state |
returns | The aggregate state |
method Task<S> BiFoldAsync <S> (S state, Func<S, A, Task<S>> Some, Func<S, Task<S>> None) Source #
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.
type | S | Aggregate state type |
param | state | Initial state |
param | Some | Folder function, applied if Option is in a Some state |
param | None | Folder function, applied if Option is in a None state |
returns | The aggregate state |
method OptionAsync<B> BiMap <B> (Func<A, B> Some, Func<Unit, B> None) Source #
Projection from one value to another
type | B | Resulting functor value type |
param | Some | Projection function |
param | None | Projection function |
returns | Mapped functor |
method OptionAsync<B> BiMap <B> (Func<A, B> Some, Func<B> None) Source #
Projection from one value to another
type | B | Resulting functor value type |
param | Some | Projection function |
param | None | Projection function |
returns | Mapped functor |
method Task<int> Count () Source #
Return the number of bound values in this structure:
None = 0
Some = 1
returns |
method Task<bool> ForAll (Func<A, bool> pred) Source #
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.
param | pred | |
returns | 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. |
method Task<bool> ForAllAsync (Func<A, Task<bool>> pred) Source #
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.
param | pred | |
returns | 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. |
method Task<bool> BiForAll (Func<A, bool> Some, Func<Unit, bool> None) Source #
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.
param | Some | Predicate to apply if in a Some state |
param | None | Predicate to apply if in a None state |
returns | 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. |
method Task<bool> BiForAll (Func<A, bool> Some, Func<bool> None) Source #
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.
param | Some | Predicate to apply if in a Some state |
param | None | Predicate to apply if in a None state |
returns | 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. |
method Task<bool> Exists (Func<A, bool> pred) Source #
Apply a predicate to the bound value. If the Option is in a None state then False is returned. If the Option is in a Some state the value is the result of running applying the bound value to the Some predicate supplied.
param | pred | |
returns | If the Option is in a None state then False is returned. If the Option is in a Some state the value is the result of running applying the bound value to the Some predicate supplied. |
method Task<bool> ExistsAsync (Func<A, Task<bool>> pred) Source #
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.
param | pred | |
returns | 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. |
method Task<bool> BiExists (Func<A, bool> Some, Func<Unit, bool> None) Source #
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.
param | pred | |
returns | 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. |
method Task<bool> BiExists (Func<A, bool> Some, Func<bool> None) Source #
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.
param | pred | |
returns | 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. |
method Task<Unit> Iter (Action<A> Some) Source #
Invoke an action for the bound value (if in a Some state)
param | Some | Action to invoke |
method Task<Unit> Iter (Func<A, Task<Unit>> Some) Source #
Invoke an action for the bound value (if in a Some state)
param | Some | Action to invoke |
method Task<Unit> BiIter (Action<A> Some, Action<Unit> None) Source #
Invoke an action depending on the state of the Option
param | Some | Action to invoke if in a Some state |
param | None | Action to invoke if in a None state |
method Task<Unit> BiIter (Action<A> Some, Action None) Source #
Invoke an action depending on the state of the Option
param | Some | Action to invoke if in a Some state |
param | None | Action to invoke if in a None state |
method OptionAsync<A> Filter (Func<A, bool> pred) Source #
Apply a predicate to the bound value (if in a Some state)
param | pred | Predicate to apply |
returns | Some(x) if the Option is in a Some state and the predicate returns True. None otherwise. |
method OptionAsync<A> FilterAsync (Func<A, Task<bool>> pred) Source #
Apply a predicate to the bound value (if in a Some state)
param | pred | Predicate to apply |
returns | Some(x) if the Option is in a Some state and the predicate returns True. None otherwise. |
method OptionAsync<A> Where (Func<A, bool> pred) Source #
Apply a predicate to the bound value (if in a Some state)
param | pred | Predicate to apply |
returns | Some(x) if the Option is in a Some state and the predicate returns True. None otherwise. |
method OptionAsync<A> Where (Func<A, Task<bool>> pred) Source #
Apply a predicate to the bound value (if in a Some state)
param | pred | Predicate to apply |
returns | Some(x) if the Option is in a Some state and the predicate returns True. None otherwise. |
method OptionAsync<D> Join <B, C, D> ( OptionAsync<B> inner, Func<A, C> outerKeyMap, Func<B, C> innerKeyMap, Func<A, B, D> project) Source #
Monadic join
method OptionAsync<D> Join <B, C, D> ( OptionAsync<B> inner, Func<A, C> outerKeyMap, Func<B, C> innerKeyMap, Func<A, B, Task<D>> project) Source #
Monadic join
method OptionAsync<D> Join <B, C, D> ( OptionAsync<B> inner, Func<A, Task<C>> outerKeyMap, Func<B, Task<C>> innerKeyMap, Func<A, B, Task<D>> project) Source #
Monadic join
method OptionAsync<D> Join <B, C, D> ( OptionAsync<B> inner, Func<A, Task<C>> outerKeyMap, Func<B, Task<C>> innerKeyMap, Func<A, B, D> project) Source #
Monadic join
method OptionAsync<Func<B, Func<C, D>>> ParMap <B, C, D> (Func<A, B, C, D> func) Source #
Partial application map
method IAsyncEnumerator<A> GetAsyncEnumerator (CancellationToken cancellationToken = default) Source #
Enumerate asynchronously
class OptionAsyncExtensions Source #
Extension methods for OptionAsync
method Task<IEnumerable<A>> Somes <A> (this IEnumerable<OptionAsync<A>> self) Source #
Extracts from a list of Option
all the Some
elements.
All the Some
elements are extracted in order.
method Task<Seq<A>> Somes <A> (this Seq<OptionAsync<A>> self) Source #
Extracts from a list of OptionAsync
all the Some
elements.
All the Some
elements are extracted in order.
method OptionAsync<A> Add <ARITH, A> (this OptionAsync<A> x, OptionAsync<A> y) Source #
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)
type | ADD | Add of A |
type | A | Bound value type |
param | x | Left hand side of the operation |
param | y | Right hand side of the operation |
returns | An option with y added to x |
method OptionAsync<A> Subtract <ARITH, A> (this OptionAsync<A> x, OptionAsync<A> y) Source #
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)
type | DIFF | Subtract of A |
type | A | Bound value type |
param | x | Left hand side of the operation |
param | y | Right hand side of the operation |
returns | An option with the subtract between x and y |
method OptionAsync<A> Product <ARITH, A> (this OptionAsync<A> x, OptionAsync<A> y) Source #
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)
type | PROD | Product of A |
type | A | Bound value type |
param | x | Left hand side of the operation |
param | y | Right hand side of the operation |
returns | An option with the product of x and y |
method OptionAsync<A> Divide <NUM, A> (this OptionAsync<A> x, OptionAsync<A> y) Source #
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)
type | DIV | Divide of A |
type | A | Bound value type |
param | x | Left hand side of the operation |
param | y | Right hand side of the operation |
returns | An option x / y |
method OptionAsync<B> Apply <A, B> (this OptionAsync<Func<A, B>> fab, OptionAsync<A> fa) Source #
Apply
param | fab | Function to apply the applicative to |
param | fa | Applicative to apply |
returns | Applicative of type FB derived from Applicative of B |
method OptionAsync<B> Apply <A, B> (this Func<A, B> fab, OptionAsync<A> fa) Source #
Apply
param | fab | Function to apply the applicative to |
param | fa | Applicative to apply |
returns | Applicative of type FB derived from Applicative of B |
method OptionAsync<C> Apply <A, B, C> (this OptionAsync<Func<A, B, C>> fabc, OptionAsync<A> fa, OptionAsync<B> fb) Source #
Apply
param | fab | Function to apply the applicative to |
param | fa | Applicative a to apply |
param | fb | Applicative b to apply |
returns | Applicative of type FC derived from Applicative of C |
method OptionAsync<C> Apply <A, B, C> (this Func<A, B, C> fabc, OptionAsync<A> fa, OptionAsync<B> fb) Source #
Apply
param | fab | Function to apply the applicative to |
param | fa | Applicative a to apply |
param | fb | Applicative b to apply |
returns | Applicative of type FC derived from Applicative of C |
method OptionAsync<Func<B, C>> Apply <A, B, C> (this OptionAsync<Func<A, B, C>> fabc, OptionAsync<A> fa) Source #
Apply
param | fab | Function to apply the applicative to |
param | fa | Applicative to apply |
returns | Applicative of type f(b -> c) derived from Applicative of Func<B, C> |
method OptionAsync<Func<B, C>> Apply <A, B, C> (this Func<A, B, C> fabc, OptionAsync<A> fa) Source #
Apply
param | fab | Function to apply the applicative to |
param | fa | Applicative to apply |
returns | Applicative of type f(b -> c) derived from Applicative of Func<B, C> |
method OptionAsync<Func<B, C>> Apply <A, B, C> (this OptionAsync<Func<A, Func<B, C>>> fabc, OptionAsync<A> fa) Source #
Apply
param | fab | Function to apply the applicative to |
param | fa | Applicative to apply |
returns | Applicative of type f(b -> c) derived from Applicative of Func<B, C> |
method OptionAsync<Func<B, C>> Apply <A, B, C> (this Func<A, Func<B, C>> fabc, OptionAsync<A> fa) Source #
Apply
param | fab | Function to apply the applicative to |
param | fa | Applicative to apply |
returns | Applicative of type f(b -> c) derived from Applicative of Func<B, C> |
method OptionAsync<B> Action <A, B> (this OptionAsync<A> fa, OptionAsync<B> fb) Source #
Evaluate fa, then fb, ignoring the result of fa
param | fa | Applicative to evaluate first |
param | fb | Applicative to evaluate second and then return |
returns | Applicative of type OptionAsync |
method Task<A?> ToNullable <A> (this OptionAsync<A> ma) Source #
Convert the Option type to a Nullable of A
type | A | Type of the bound value |
param | ma | Option to convert |
returns | Nullable of A |
method Task<IEnumerable<R>> Match <T, R> (this IEnumerable<OptionAsync<T>> list, Func<T, IEnumerable<R>> Some, Func<IEnumerable<R>> None ) Source #
Match over a list of options
type | T | Type of the bound values |
type | R | Result type |
param | list | List of options to match against |
param | Some | Operation to perform when an Option is in the Some state |
param | None | Operation to perform when an Option is in the None state |
returns | An enumerable of results of the match operations |
method Task<IEnumerable<R>> Match <T, R> (this IEnumerable<OptionAsync<T>> list, Func<T, IEnumerable<R>> Some, IEnumerable<R> None) Source #
Match over a list of options
type | T | Type of the bound values |
type | R | Result type |
param | list | List of options to match against |
param | Some | Operation to perform when an Option is in the Some state |
param | None | Default if the list is empty |
returns | An enumerable of results of the match operations |
struct OptionAsyncMethodBuilder <A> Source #
method void Start <TStateMachine> (ref TStateMachine machine) Source #
method void SetStateMachine (IAsyncStateMachine machine) Source #
method void SetException (Exception _) Source #
method void AwaitOnCompleted <TAwaiter, TStateMachine> (ref TAwaiter awaiter, ref TStateMachine machine) Source #
method void AwaitUnsafeOnCompleted <TAwaiter, TStateMachine> (ref TAwaiter awaiter, ref TStateMachine machine) Source #
method OptionAsync<T> subtract <NUM, T> (OptionAsync<T> lhs, OptionAsync<T> rhs) Source #
Subtract the Ts
param | lhs | Left-hand side of the operation |
param | rhs | Right-hand side of the operation |
returns | lhs - rhs |
method OptionAsync<T> product <NUM, T> (OptionAsync<T> lhs, OptionAsync<T> rhs) Source #
method OptionAsync<T> divide <NUM, T> (OptionAsync<T> lhs, OptionAsync<T> rhs) Source #
Divide the Ts
param | lhs | Left-hand side of the operation |
param | rhs | Right-hand side of the operation |
returns | lhs / rhs |
method OptionAsync<T> add <NUM, T> (OptionAsync<T> lhs, OptionAsync<T> rhs) Source #
Add the Ts
param | lhs | Left-hand side of the operation |
param | rhs | Right-hand side of the operation |
returns | lhs / rhs |
method Task<bool> isSome <T> (OptionAsync<T> value) Source #
Check if OptionAsync is in a Some state
type | T | T |
param | value | OptionAsync |
returns | True if value is in a Some state |
method Task<bool> isNone <T> (OptionAsync<T> value) Source #
Check if OptionAsync is in a None state
type | T | T |
param | value | OptionAsync |
returns | True if value is in a None state |
method OptionAsync<T> SomeAsync <T> (T value) Source #
Create a Some of T (OptionAsync
type | T | T |
param | value | Non-null value to be made OptionAsyncal |
returns |
|
method OptionAsync<T> SomeAsync <T> (Task<T> taskValue) Source #
Create a lazy Some of T (OptionAsync
type | T | T |
param | value | Non-null value to be made OptionAsyncal |
returns | OptionAsync |
method OptionAsync<Task<A>> SomeValueAsync <A> (Task<A> taskValue) Source #
Create a lazy Some of T (OptionAsync
type | T | T |
param | value | Non-null value to be made OptionAsyncal |
returns | OptionAsync |
method OptionAsync<T> SomeAsync <T> (Func<Unit, Task<T>> f) Source #
Create a lazy Some of T (OptionAsync
type | T | T |
param | value | Non-null value to be made OptionAsyncal |
returns | OptionAsync |
method OptionAsync<T> SomeAsync <T> (Func<Task<T>> f) Source #
Create a lazy Some of T (OptionAsync
type | T | T |
param | value | Non-null value to be made OptionAsyncal |
returns | OptionAsync |
method OptionAsync<T> SomeAsync <T> (T? value) Source #
Create a Some of T from a Nullable
type | T | T |
param | value | Non-null value to be made OptionAsyncal |
returns | OptionAsync |
method OptionAsync<T> OptionalAsync <T> (Task<T?> value) Source #
Create an OptionAsync
type | T | T |
param | value | Value to be made OptionAsyncal, or null |
returns | If the value is null it will be None else Some(value) |
method OptionAsync<T> OptionalAsync <T> (Func<Unit, Task<T?>> f) Source #
Create a lazy OptionAsync of T (OptionAsync
type | T | T |
param | f | A function that returns the value to construct the OptionAsync with |
returns | A lazy OptionAsync |
method OptionAsync<T> OptionalAsync <T> (T? value) Source #
Create an OptionAsync
type | T | T |
param | value | Value to be made OptionAsyncal, or null |
returns | If the value is null it will be None else Some(value) |
method Task<Unit> ifSome <T> (OptionAsync<T> OptionAsync, Action<T> Some) Source #
Invokes the action if OptionAsync is in the Some state, otherwise nothing happens.
param | f | Action to invoke if OptionAsync is in the Some state |
method Task<T> ifNone <T> (OptionAsync<T> ma, Func<T> None) Source #
Returns the result of invoking the None() operation if the OptionAsyncal is in a None state, otherwise the bound Some(x) value is returned.
Will not accept a null return value from the None operation
param | None | Operation to invoke if the structure is in a None state |
returns | Tesult of invoking the None() operation if the OptionAsyncal is in a None state, otherwise the bound Some(x) value is returned. |
method Task<T> ifNone <T> (OptionAsync<T> ma, T noneValue) Source #
Returns the noneValue if the OptionAsyncal is in a None state, otherwise the bound Some(x) value is returned.
Will not accept a null noneValue
param | noneValue | Value to return if in a None state |
returns | noneValue if the OptionAsyncal is in a None state, otherwise the bound Some(x) value is returned |
method Task<T> ifNoneUnsafe <T> (OptionAsync<T> ma, Func<T> None) Source #
Returns the result of invoking the None() operation if the OptionAsyncal is in a None state, otherwise the bound Some(x) value is returned.
Will allow null the be returned from the None operation
param | None | Operation to invoke if the structure is in a None state |
returns | Tesult of invoking the None() operation if the OptionAsyncal is in a None state, otherwise the bound Some(x) value is returned. |
method Task<T> ifNoneUnsafe <T> (OptionAsync<T> ma, T noneValue) Source #
Returns the noneValue if the OptionAsyncal is in a None state, otherwise the bound Some(x) value is returned.
Will allow noneValue to be null
param | noneValue | Value to return if in a None state |
returns | noneValue if the OptionAsyncal is in a None state, otherwise the bound Some(x) value is returned |
method Task<R> match <T, R> (OptionAsync<T> ma, Func<T, R> Some, Func<R> None) Source #
Match the two states of the OptionAsync and return a non-null R.
type | B | Return type |
param | Some | Some match operation. Must not return null. |
param | None | None match operation. Must not return null. |
returns | A non-null B |
method Task<R> matchAsync <T, R> (OptionAsync<T> ma, Func<T, Task<R>> Some, Func<R> None) Source #
Match the two states of the OptionAsync and return a non-null R.
type | B | Return type |
param | Some | Some match operation. Must not return null. |
param | None | None match operation. Must not return null. |
returns | A non-null B |
method Task<R> matchAsync <T, R> (OptionAsync<T> ma, Func<T, R> Some, Func<Task<R>> None) Source #
Match the two states of the OptionAsync and return a non-null R.
type | B | Return type |
param | Some | Some match operation. Must not return null. |
param | None | None match operation. Must not return null. |
returns | A non-null B |
method Task<R> matchAsync <T, R> (OptionAsync<T> ma, Func<T, Task<R>> Some, Func<Task<R>> None) Source #
Match the two states of the OptionAsync and return a non-null R.
type | B | Return type |
param | Some | Some match operation. Must not return null. |
param | None | None match operation. Must not return null. |
returns | A non-null B |
method Task<R> matchUnsafe <T, R> (OptionAsync<T> ma, Func<T, R> Some, Func<R> None) Source #
Match the two states of the OptionAsync and return a B, which can be null.
type | B | Return type |
param | Some | Some match operation. May return null. |
param | None | None match operation. May return null. |
returns | B, or null |
method Task<R> matchUnsafeAsync <T, R> (OptionAsync<T> ma, Func<T, Task<R>> Some, Func<R> None) Source #
Match the two states of the OptionAsync and return a B, which can be null.
type | B | Return type |
param | Some | Some match operation. May return null. |
param | None | None match operation. May return null. |
returns | B, or null |
method Task<R> matchUnsafeAsync <T, R> (OptionAsync<T> ma, Func<T, R> Some, Func<Task<R>> None) Source #
Match the two states of the OptionAsync and return a B, which can be null.
type | B | Return type |
param | Some | Some match operation. May return null. |
param | None | None match operation. May return null. |
returns | B, or null |
method Task<R> matchUnsafeAsync <T, R> (OptionAsync<T> ma, Func<T, Task<R>> Some, Func<Task<R>> None) Source #
Match the two states of the OptionAsync and return a B, which can be null.
type | B | Return type |
param | Some | Some match operation. May return null. |
param | None | None match operation. May return null. |
returns | B, or null |
method Task<Unit> match <T> (OptionAsync<T> ma, Action<T> Some, Action None) Source #
Match the two states of the OptionAsync
param | Some | Some match operation |
param | None | None match operation |
method OptionAsync<B> apply <A, B> (OptionAsync<Func<A, B>> fab, OptionAsync<A> fa) Source #
Apply
param | fab | Function to apply the applicative to |
param | fa | Applicative to apply |
returns | Applicative of type FB derived from Applicative of B |
method OptionAsync<B> apply <A, B> (Func<A, B> fab, OptionAsync<A> fa) Source #
Apply
param | fab | Function to apply the applicative to |
param | fa | Applicative to apply |
returns | Applicative of type FB derived from Applicative of B |
method OptionAsync<C> apply <A, B, C> (OptionAsync<Func<A, B, C>> fabc, OptionAsync<A> fa, OptionAsync<B> fb) Source #
Apply
param | fab | Function to apply the applicative to |
param | fa | Applicative a to apply |
param | fb | Applicative b to apply |
returns | Applicative of type FC derived from Applicative of C |
method OptionAsync<C> apply <A, B, C> (Func<A, B, C> fabc, OptionAsync<A> fa, OptionAsync<B> fb) Source #
Apply
param | fab | Function to apply the applicative to |
param | fa | Applicative a to apply |
param | fb | Applicative b to apply |
returns | Applicative of type FC derived from Applicative of C |
method OptionAsync<Func<B, C>> apply <A, B, C> (OptionAsync<Func<A, B, C>> fabc, OptionAsync<A> fa) Source #
Apply
param | fab | Function to apply the applicative to |
param | fa | Applicative to apply |
returns | Applicative of type f(b -> c) derived from Applicative of Func<B, C> |
method OptionAsync<Func<B, C>> apply <A, B, C> (Func<A, B, C> fabc, OptionAsync<A> fa) Source #
Apply
param | fab | Function to apply the applicative to |
param | fa | Applicative to apply |
returns | Applicative of type f(b -> c) derived from Applicative of Func<B, C> |
method OptionAsync<Func<B, C>> apply <A, B, C> (OptionAsync<Func<A, Func<B, C>>> fabc, OptionAsync<A> fa) Source #
Apply
param | fab | Function to apply the applicative to |
param | fa | Applicative to apply |
returns | Applicative of type f(b -> c) derived from Applicative of Func<B, C> |
method OptionAsync<Func<B, C>> apply <A, B, C> (Func<A, Func<B, C>> fabc, OptionAsync<A> fa) Source #
Apply
param | fab | Function to apply the applicative to |
param | fa | Applicative to apply |
returns | Applicative of type f(b -> c) derived from Applicative of Func<B, C> |
method OptionAsync<B> action <A, B> (OptionAsync<A> fa, OptionAsync<B> fb) Source #
Evaluate fa, then fb, ignoring the result of fa
param | fa | Applicative to evaluate first |
param | fb | Applicative to evaluate second and then return |
returns | Applicative of type OptionAsync |
method Task<S> fold <S, A> (OptionAsync<A> ma, S state, Func<S, A, S> folder) Source #
OptionAsync 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.
type | S | Aggregate state type |
param | state | Initial state |
param | folder | Folder function, applied if OptionAsync is in a Some state |
returns | The aggregate state |
method Task<S> fold <S, A> (OptionAsync<A> ma, S state, Func<S, A, Task<S>> folder) Source #
OptionAsync 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.
type | S | Aggregate state type |
param | state | Initial state |
param | folder | Folder function, applied if OptionAsync is in a Some state |
returns | The aggregate state |
method Task<S> bifold <S, A> (OptionAsync<A> ma, S state, Func<S, A, S> Some, Func<S, S> None) Source #
OptionAsync 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.
type | S | Aggregate state type |
param | state | Initial state |
param | Some | Folder function, applied if OptionAsync is in a Some state |
param | None | Folder function, applied if OptionAsync is in a None state |
returns | The aggregate state |
method Task<S> bifold <S, A> (OptionAsync<A> ma, S state, Func<S, A, Task<S>> Some, Func<S, S> None) Source #
OptionAsync 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.
type | S | Aggregate state type |
param | state | Initial state |
param | Some | Folder function, applied if OptionAsync is in a Some state |
param | None | Folder function, applied if OptionAsync is in a None state |
returns | The aggregate state |
method Task<S> bifold <S, A> (OptionAsync<A> ma, S state, Func<S, A, S> Some, Func<S, Task<S>> None) Source #
OptionAsync 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.
type | S | Aggregate state type |
param | state | Initial state |
param | Some | Folder function, applied if OptionAsync is in a Some state |
param | None | Folder function, applied if OptionAsync is in a None state |
returns | The aggregate state |
method Task<S> bifold <S, A> (OptionAsync<A> ma, S state, Func<S, A, Task<S>> Some, Func<S, Task<S>> None) Source #
OptionAsync 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.
type | S | Aggregate state type |
param | state | Initial state |
param | Some | Folder function, applied if OptionAsync is in a Some state |
param | None | Folder function, applied if OptionAsync is in a None state |
returns | The aggregate state |
method Task<S> bifold <S, A> (OptionAsync<A> ma, S state, Func<S, A, S> Some, Func<S, Unit, S> None) Source #
OptionAsync 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.
type | S | Aggregate state type |
param | state | Initial state |
param | Some | Folder function, applied if OptionAsync is in a Some state |
param | None | Folder function, applied if OptionAsync is in a None state |
returns | The aggregate state |
method Task<S> bifold <S, A> (OptionAsync<A> ma, S state, Func<S, A, Task<S>> Some, Func<S, Unit, S> None) Source #
OptionAsync 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.
type | S | Aggregate state type |
param | state | Initial state |
param | Some | Folder function, applied if OptionAsync is in a Some state |
param | None | Folder function, applied if OptionAsync is in a None state |
returns | The aggregate state |
method Task<S> bifold <S, A> (OptionAsync<A> ma, S state, Func<S, A, S> Some, Func<S, Unit, Task<S>> None) Source #
OptionAsync 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.
type | S | Aggregate state type |
param | state | Initial state |
param | Some | Folder function, applied if OptionAsync is in a Some state |
param | None | Folder function, applied if OptionAsync is in a None state |
returns | The aggregate state |
method Task<S> bifold <S, A> (OptionAsync<A> ma, S state, Func<S, A, Task<S>> Some, Func<S, Unit, Task<S>> None) Source #
OptionAsync 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.
type | S | Aggregate state type |
param | state | Initial state |
param | Some | Folder function, applied if OptionAsync is in a Some state |
param | None | Folder function, applied if OptionAsync is in a None state |
returns | The aggregate state |
method Task<bool> forall <A> (OptionAsync<A> ma, Func<A, bool> pred) Source #
Apply a predicate to the bound value. If the OptionAsync is in a None state then True is returned (because the predicate applies for-all values). If the OptionAsync is in a Some state the value is the result of running applying the bound value to the predicate supplied.
param | pred | Predicate to apply |
returns | If the OptionAsync is in a None state then True is returned (because the predicate applies for-all values). If the OptionAsync is in a Some state the value is the result of running applying the bound value to the predicate supplied. |
method Task<bool> biforall <A> (OptionAsync<A> ma, Func<A, bool> Some, Func<Unit, bool> None) Source #
Apply a predicate to the bound value. If the OptionAsync is in a None state then True is returned if invoking None returns True. If the OptionAsync is in a Some state the value is the result of running applying the bound value to the Some predicate supplied.
param | Some | Predicate to apply if in a Some state |
param | None | Predicate to apply if in a None state |
returns | If the OptionAsync is in a None state then True is returned if invoking None returns True. If the OptionAsync is in a Some state the value is the result of running applying the bound value to the Some predicate supplied. |
method Task<bool> biforall <A> (OptionAsync<A> ma, Func<A, bool> Some, Func<bool> None) Source #
Apply a predicate to the bound value. If the OptionAsync is in a None state then True is returned if invoking None returns True. If the OptionAsync is in a Some state the value is the result of running applying the bound value to the Some predicate supplied.
param | Some | Predicate to apply if in a Some state |
param | None | Predicate to apply if in a None state |
returns | If the OptionAsync is in a None state then True is returned if invoking None returns True. If the OptionAsync is in a Some state the value is the result of running applying the bound value to the Some predicate supplied. |
method Task<int> count <A> (OptionAsync<A> ma) Source #
Return the number of bound values in this structure:
None = 0
Some = 1
returns |
method Task<bool> exists <A> (OptionAsync<A> ma, Func<A, bool> pred) Source #
Apply a predicate to the bound value. If the OptionAsync is in a None state then True is returned if invoking None returns True. If the OptionAsync is in a Some state the value is the result of running applying the bound value to the Some predicate supplied.
param | pred | Predicate to apply |
returns | If the OptionAsync is in a None state then True is returned if invoking None returns True. If the OptionAsync is in a Some state the value is the result of running applying the bound value to the Some predicate supplied. |
method Task<bool> biexists <A> (OptionAsync<A> ma, Func<A, bool> Some, Func<Unit, bool> None) Source #
Apply a predicate to the bound value. If the OptionAsync is in a None state then True is returned if invoking None returns True. If the OptionAsync is in a Some state the value is the result of running applying the bound value to the Some predicate supplied.
param | Some | Predicate to apply if in a Some state |
param | None | Predicate to apply if in a None state |
returns | If the OptionAsync is in a None state then True is returned if invoking None returns True. If the OptionAsync is in a Some state the value is the result of running applying the bound value to the Some predicate supplied. |
method Task<bool> biexists <A> (OptionAsync<A> ma, Func<A, bool> Some, Func<bool> None) Source #
Apply a predicate to the bound value. If the OptionAsync is in a None state then True is returned if invoking None returns True. If the OptionAsync is in a Some state the value is the result of running applying the bound value to the Some predicate supplied.
param | Some | Predicate to apply if in a Some state |
param | None | Predicate to apply if in a None state |
returns | If the OptionAsync is in a None state then True is returned if invoking None returns True. If the OptionAsync is in a Some state the value is the result of running applying the bound value to the Some predicate supplied. |
method OptionAsync<B> map <A, B> (OptionAsync<A> ma, Func<A, B> f) Source #
Projection from one value to another
type | B | Resulting functor value type |
param | f | Projection function |
returns | Mapped functor |
method OptionAsync<B> bimap <A, B> (OptionAsync<A> ma, Func<A, B> Some, Func<B> None) Source #
Projection from one value to another
type | B | Resulting functor value type |
param | Some | Projection function |
param | None | Projection function |
returns | Mapped functor |
method OptionAsync<B> bimap <A, B> (OptionAsync<A> ma, Func<A, B> Some, Func<Unit, B> None) Source #
Projection from one value to another
type | B | Resulting functor value type |
param | Some | Projection function |
param | None | Projection function |
returns | Mapped functor |
method OptionAsync<Func<T2, R>> parmap <T1, T2, R> (OptionAsync<T1> ma, Func<T1, T2, R> mapper) Source #
Partial application map
method OptionAsync<Func<T2, Func<T3, R>>> parmap <T1, T2, T3, R> (OptionAsync<T1> ma, Func<T1, T2, T3, R> mapper) Source #
Partial application map
method OptionAsync<T> filter <T> (OptionAsync<T> ma, Func<T, bool> pred) Source #
Apply a predicate to the bound value (if in a Some state)
param | pred | Predicate to apply |
returns | Some(x) if the OptionAsync is in a Some state and the predicate returns True. None otherwise. |
method OptionAsync<R> bind <T, R> (OptionAsync<T> ma, Func<T, OptionAsync<R>> binder) Source #
Monadic bind operation
method Task<IEnumerable<R>> match <T, R> (IEnumerable<OptionAsync<T>> list, Func<T, IEnumerable<R>> Some, Func<IEnumerable<R>> None ) Source #
Match the two states of the list of OptionAsyncs
param | Some | Some match operation |
param | None | None match operation |
method Task<IEnumerable<R>> match <T, R> (IEnumerable<OptionAsync<T>> list, Func<T, IEnumerable<R>> Some, IEnumerable<R> None) Source #
Match the two states of the list of OptionAsyncs
param | Some | Some match operation |
param | None | None match operation |
method Task<IEnumerable<T>> somes <T> (IEnumerable<OptionAsync<T>> list) Source #
Extracts from a list of 'OptionAsync' all the 'Some' elements. All the 'Some' elements are extracted in order.