LanguageExt.Core

LanguageExt.Core Monads Alternative Value Monads Try TryOption

Contents

class TaskTryOptionExtensions Source #

Methods

method TryOptionAsync<A> ToAsync <A> (this Task<TryOption<A>> self) Source #

Convert a Task<TryOption> to a TryOptionAsync

method TryOptionAsync<A> ToAsync <A> (this TryOption<Task<A>> self) Source #

Convert a Task<TryOption> to a TryOptionAsync

method Task<Unit> IfSome <A> (this Task<TryOption<A>> self, Action<A> Some) Source #

Invoke a delegate if the Try returns a value successfully

Parameters

param Some

Delegate to invoke if successful

method Task<Unit> IfNoneOrFail <A> (this Task<TryOption<A>> self, Action None) Source #

Invoke a delegate if the Try is in a Fail or None state

Parameters

param None

Delegate to invoke if successful

method Task<A> IfNoneOrFail <A> (this Task<TryOption<A>> self, A defaultValue) Source #

Return a default value if the Try fails

Parameters

param defaultValue

Default value to use on failure

returns

failValue on failure, the result of the Try otherwise

method Task<A> IfNoneOrFail <A> (this Task<TryOption<A>> self, Func<A> None) Source #

Invoke a delegate if the Try fails

Parameters

param None

Delegate to invoke on failure

returns

Result of the invocation of Fail on failure, the result of the Try otherwise

method Task<A> IfNoneOrFail <A> (this Task<TryOption<A>> self, Func<Task<A>> None) Source #

Invoke a delegate if the Try fails

Parameters

param None

Delegate to invoke on failure

returns

Result of the invocation of Fail on failure, the result of the Try otherwise

method Task<A> IfNoneOrFail <A> ( this Task<TryOption<A>> self, Func<A> None, Func<Exception, A> Fail) Source #

Invoke delegates based on None or Failed stateds

Parameters

type T

Bound value type

param self

Try computation

param None

Delegate to invoke if the result is None

param Fail

Delegate to invoke if the result is Fail

returns

Success value, or the result of the None or Failed delegate

method Task<A> IfNoneOrFail <A> ( this Task<TryOption<A>> self, Func<Task<A>> None, Func<Exception, A> Fail) Source #

Invoke delegates based on None or Failed stateds

Parameters

type T

Bound value type

param self

Try computation

param None

Delegate to invoke if the result is None

param Fail

Delegate to invoke if the result is Fail

returns

Success value, or the result of the None or Failed delegate

method Task<A> IfNoneOrFail <A> ( this Task<TryOption<A>> self, Func<A> None, Func<Exception, Task<A>> Fail) Source #

Invoke delegates based on None or Failed stateds

Parameters

type T

Bound value type

param self

Try computation

param None

Delegate to invoke if the result is None

param Fail

Delegate to invoke if the result is Fail

returns

Success value, or the result of the None or Failed delegate

method Task<A> IfNoneOrFail <A> ( this Task<TryOption<A>> self, Func<Task<A>> None, Func<Exception, Task<A>> Fail) Source #

Invoke delegates based on None or Failed stateds

Parameters

type T

Bound value type

param self

Try computation

param None

Delegate to invoke if the result is None

param Fail

Delegate to invoke if the result is Fail

returns

Success value, or the result of the None or Failed delegate

method ExceptionMatchOptionalAsync<A> IfFail <A> (this Task<TryOption<A>> self) Source #

Provides a fluent exception matching interface which is invoked when the Try fails.

Parameters

returns

Fluent exception matcher

method Task<R> Match <A, R> (this Task<TryOption<A>> self, Func<A, R> Succ, Func<R> Fail) Source #

Pattern matches the two possible states of the Try computation

Parameters

type R

Type of the resulting bound value

param Succ

Delegate to invoke if the Try computation completes successfully

param Fail

Delegate to invoke if the Try computation fails

returns

The result of either the Succ or Fail delegates

method Task<R> Match <A, R> (this Task<TryOption<A>> self, Func<A, R> Some, Func<R> None, Func<Exception, R> Fail) Source #

Pattern matches the two possible states of the Try computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the Try computation completes successfully

param Fail

Delegate to invoke if the Try computation fails

returns

The result of either the Succ or Fail delegates

method Task<R> Match <A, R> (this Task<TryOption<A>> self, Func<A, R> Succ, R Fail) Source #

Pattern matches the two possible states of the Try computation

Parameters

type R

Type of the resulting bound value

param Succ

Delegate to invoke if the Try computation completes successfully

param Fail

Default value to use if the Try computation fails

returns

The result of either the Succ delegate or the Fail value

method Task<Unit> Match <A> (this Task<TryOption<A>> self, Action<A> Succ, Action Fail) Source #

Pattern matches the two possible states of the Try computation

Parameters

param Succ

Delegate to invoke if the Try computation completes successfully

param Fail

Delegate to invoke if the Try computation fails

method Task<Unit> Match <A> (this Task<TryOption<A>> self, Action<A> Some, Action None, Action<Exception> Fail) Source #

Pattern matches the two possible states of the Try computation

Parameters

param Some

Delegate to invoke if the Try computation completes successfully

param Fail

Delegate to invoke if the Try computation fails

method Task<R> MatchAsync <A, R> (this Task<TryOption<A>> self, Func<A, Task<R>> Some, Func<R> None, Func<Exception, R> Fail) Source #

Pattern matches the three possible states of the computation computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the computation completes successfully

param None

Delegate to invoke if the computation completes successfully but returns no value

param Fail

Delegate to invoke if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> MatchAsync <A, R> (this Task<TryOption<A>> self, Func<A, Task<R>> Succ, Func<Task<R>> Fail) Source #

Pattern matches the three possible states of the computation computation

Parameters

type R

Type of the resulting bound value

param Succ

Delegate to invoke if the computation completes successfully

param Fail

Delegate to invoke if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> MatchAsync <A, R> (this Task<TryOption<A>> self, Func<A, Task<R>> Some, Func<Task<R>> None, Func<Exception, Task<R>> Fail) Source #

Pattern matches the three possible states of the computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the computation completes successfully

param None

Delegate to invoke if the computation completes successfully but returns no value

param Fail

Delegate to invoke if the computation fails

returns

The result of either the Some, None, or Fail delegate

method Task<R> MatchAsync <A, R> (this Task<TryOption<A>> self, Func<A, R> Succ, Func<Task<R>> Fail) Source #

Pattern matches the three possible states of the computation computation

Parameters

type R

Type of the resulting bound value

param Succ

Delegate to invoke if the computation completes successfully

param Fail

Delegate to invoke if the computation fails

returns

The result of either the Succ, Fail delegate

method Task<R> MatchAsync <A, R> (this Task<TryOption<A>> self, Func<A, R> Some, Func<Task<R>> None, Func<Exception, Task<R>> Fail) Source #

Pattern matches the three possible states of the computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the computation completes successfully

param None

Delegate to invoke if the computation completes successfully but returns no value

param Fail

Delegate to invoke if the computation fails

returns

The result of either the Some, None, or Fail delegate

method Task<Option<A>> ToOption <A> (this Task<TryOption<A>> self) Source #

method Task<A> IfFailThrow <A> (this Task<TryOption<A>> self) Source #

method Task<Unit> Iter <A> (this Task<TryOption<A>> self, Action<A> action) Source #

Apply Try values to a Try function of arity 2

Parameters

param self

Try function

param arg1

Try argument

param arg2

Try argument

returns

Returns the result of applying the Try arguments to the Try function

method Task<int> Count <A> (this Task<TryOption<A>> self) Source #

Counts the number of bound values.

Parameters

type T

Type of the bound value

param self

TrTry computation

returns

1 if the Try computation is successful, 0 otherwise.

method Task<bool> ForAll <A> (this Task<TryOption<A>> self, Func<A, bool> pred) Source #

Tests that a predicate holds for all values of the bound value T

Parameters

type T

Type of the bound value

param self

Try computation

param pred

Predicate to test the bound value against

returns

True if the predicate holds for the bound value, or if the Try computation fails. False otherwise.

method Task<bool> ForAllAsync <A> (this Task<TryOption<A>> self, Func<A, Task<bool>> pred) Source #

Tests that a predicate holds for all values of the bound value T

Parameters

type T

Type of the bound value

param self

Try computation

param pred

Predicate to test the bound value against

returns

True if the predicate holds for the bound value, or if the Try computation fails. False otherwise.

method Task<S> Fold <A, S> (this Task<TryOption<A>> self, S state, Func<S, A, S> folder) Source #

Parameters

param self

Try to fold

param state

Initial state

param folder

Fold function

returns

Folded state

method Task<S> FoldAsync <A, S> (this Task<TryOption<A>> self, S state, Func<S, A, Task<S>> folder) Source #

Parameters

param self

Try to fold

param state

Initial state

param folder

Fold function

returns

Folded state

method Task<S> BiFold <A, S> (this Task<TryOption<A>> self, S state, Func<S, A, S> Succ, Func<S, S> Fail) Source #

Parameters

param self

Try to fold

param state

Initial state

param Succ

Fold function for Success

param Fail

Fold function for Failure

returns

Folded state

method Task<S> BiFold <A, S> (this Task<TryOption<A>> self, S state, Func<S, A, Task<S>> Succ, Func<S, S> Fail) Source #

Parameters

param self

Try to fold

param state

Initial state

param Succ

Fold function for Success

param Fail

Fold function for Failure

returns

Folded state

method Task<S> BiFold <A, S> (this Task<TryOption<A>> self, S state, Func<S, A, S> Succ, Func<S, Task<S>> Fail) Source #

Parameters

param self

Try to fold

param state

Initial state

param Succ

Fold function for Success

param Fail

Fold function for Failure

returns

Folded state

method Task<S> BiFold <A, S> (this Task<TryOption<A>> self, S state, Func<S, A, Task<S>> Succ, Func<S, Task<S>> Fail) Source #

Parameters

param self

Try to fold

param state

Initial state

param Succ

Fold function for Success

param Fail

Fold function for Failure

returns

Folded state

method Task<S> TriFold <A, S> (this Task<TryOption<A>> self, S state, Func<S, A, S> Some, Func<S, S> None, Func<S, Exception, S> Fail) Source #

Parameters

param self

Try to fold

param state

Initial state

param Some

Fold function for Success

param None

Fold function for None

param Fail

Fold function for Failure

returns

Folded state

method Task<S> TriFold <A, S> (this Task<TryOption<A>> self, S state, Func<S, A, Task<S>> Some, Func<S, S> None, Func<S, Exception, S> Fail) Source #

Parameters

param self

Try to fold

param state

Initial state

param Some

Fold function for Success

param None

Fold function for None

param Fail

Fold function for Failure

returns

Folded state

method Task<S> TriFold <A, S> (this Task<TryOption<A>> self, S state, Func<S, A, S> Some, Func<S, Task<S>> None, Func<S, Exception, S> Fail) Source #

Parameters

param self

Try to fold

param state

Initial state

param Some

Fold function for Success

param None

Fold function for None

param Fail

Fold function for Failure

returns

Folded state

method Task<S> TriFold <A, S> (this Task<TryOption<A>> self, S state, Func<S, A, S> Some, Func<S, S> None, Func<S, Exception, Task<S>> Fail) Source #

Parameters

param self

Try to fold

param state

Initial state

param Some

Fold function for Success

param None

Fold function for None

param Fail

Fold function for Failure

returns

Folded state

method Task<S> TriFold <A, S> (this Task<TryOption<A>> self, S state, Func<S, A, Task<S>> Some, Func<S, Task<S>> None, Func<S, Exception, S> Fail) Source #

Parameters

param self

Try to fold

param state

Initial state

param Some

Fold function for Success

param None

Fold function for None

param Fail

Fold function for Failure

returns

Folded state

method Task<S> TriFold <A, S> (this Task<TryOption<A>> self, S state, Func<S, A, S> Some, Func<S, Task<S>> None, Func<S, Exception, Task<S>> Fail) Source #

Parameters

param self

Try to fold

param state

Initial state

param Some

Fold function for Success

param None

Fold function for None

param Fail

Fold function for Failure

returns

Folded state

method Task<S> TriFold <A, S> (this Task<TryOption<A>> self, S state, Func<S, A, Task<S>> Some, Func<S, Task<S>> None, Func<S, Exception, Task<S>> Fail) Source #

Parameters

param self

Try to fold

param state

Initial state

param Some

Fold function for Success

param None

Fold function for None

param Fail

Fold function for Failure

returns

Folded state

method Task<bool> Exists <A> (this Task<TryOption<A>> self, Func<A, bool> pred) Source #

Tests that a predicate holds for any value of the bound value T

Parameters

type A

Type of the bound value

param self

Try computation

param pred

Predicate to test the bound value against

returns

True if the predicate holds for the bound value. False otherwise.

method Task<bool> ExistsAsync <A> (this Task<TryOption<A>> self, Func<A, Task<bool>> pred) Source #

Tests that a predicate holds for any value of the bound value T

Parameters

type A

Type of the bound value

param self

Try computation

param pred

Predicate to test the bound value against

returns

True if the predicate holds for the bound value. False otherwise.

method TryOptionAsync<R> Map <A, R> (this Task<TryOption<A>> self, Func<A, R> mapper) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type R

Resulting bound value type

param self

Try computation

param mapper

Delegate to map the bound value

returns

Mapped Try computation

method TryOptionAsync<R> MapAsync <A, R> (this Task<TryOption<A>> self, Func<A, Task<R>> mapper) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type R

Resulting bound value type

param self

Try computation

param mapper

Delegate to map the bound value

returns

Mapped Try computation

method TryOptionAsync<B> BiMap <A, B> (this Task<TryOption<A>> self, Func<A, B> Succ, Func<B> Fail) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param Succ

Delegate to map the bound value

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped computation

method TryOptionAsync<B> BiMap <A, B> (this Task<TryOption<A>> self, Func<A, Task<B>> Succ, Func<B> Fail) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param Succ

Delegate to map the bound value

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped computation

method TryOptionAsync<B> BiMap <A, B> (this Task<TryOption<A>> self, Func<A, B> Succ, Func<Task<B>> Fail) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param Succ

Delegate to map the bound value

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped computation

method TryOptionAsync<B> BiMap <A, B> (this Task<TryOption<A>> self, Func<A, Task<B>> Succ, Func<Task<B>> Fail) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param Succ

Delegate to map the bound value

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped computation

method TryOptionAsync<B> TriMap <A, B> (this Task<TryOption<A>> self, Func<A, B> Some, Func<B> None, Func<Exception, B> Fail) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param Some

Delegate to map the bound value

param None

Delegate to map the None to the desired bound result type

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped computation

method TryOptionAsync<B> TriMap <A, B> (this Task<TryOption<A>> self, Func<A, Task<B>> Some, Func<B> None, Func<Exception, B> Fail) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param Some

Delegate to map the bound value

param None

Delegate to map the None to the desired bound result type

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped computation

method TryOptionAsync<B> TriMap <A, B> (this Task<TryOption<A>> self, Func<A, B> Some, Func<Task<B>> None, Func<Exception, B> Fail) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param Some

Delegate to map the bound value

param None

Delegate to map the None to the desired bound result type

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped computation

method TryOptionAsync<B> TriMap <A, B> (this Task<TryOption<A>> self, Func<A, B> Some, Func<B> None, Func<Exception, Task<B>> Fail) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param Some

Delegate to map the bound value

param None

Delegate to map the None to the desired bound result type

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped computation

method TryOptionAsync<B> TriMap <A, B> (this Task<TryOption<A>> self, Func<A, Task<B>> Some, Func<Task<B>> None, Func<Exception, B> Fail) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param Some

Delegate to map the bound value

param None

Delegate to map the None to the desired bound result type

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped computation

method TryOptionAsync<B> TriMap <A, B> (this Task<TryOption<A>> self, Func<A, B> Some, Func<Task<B>> None, Func<Exception, Task<B>> Fail) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param Some

Delegate to map the bound value

param None

Delegate to map the None to the desired bound result type

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped computation

method TryOptionAsync<B> TriMap <A, B> (this Task<TryOption<A>> self, Func<A, Task<B>> Some, Func<Task<B>> None, Func<Exception, Task<B>> Fail) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param Some

Delegate to map the bound value

param None

Delegate to map the None to the desired bound result type

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped computation

method TryOptionAsync<A> Filter <A> (this Task<TryOption<A>> self, Func<A, bool> pred) Source #

method TryOptionAsync<A> Filter <A> (this Task<TryOption<A>> self, Func<A, Task<bool>> pred) Source #

method TryOptionAsync<A> Where <A> (this Task<TryOption<A>> self, Func<A, bool> pred) Source #

method TryOptionAsync<A> Where <A> (this Task<TryOption<A>> self, Func<A, Task<bool>> pred) Source #

method Task<Seq<A>> AsEnumerable <A> (this Task<TryOption<A>> self) Source #

method Task<Seq<A>> ToSeq <A> (this Task<TryOption<A>> self) Source #

method Task<Lst<A>> ToList <A> (this Task<TryOption<A>> self) Source #

method Task<Arr<A>> ToArray <A> (this Task<TryOption<A>> self) Source #

method Task<string> AsString <A> (this Task<TryOption<A>> self) Source #

method Task<int> Sum (this Task<TryOption<int>> self) Source #

method TryOptionAsync<A> Add <NUM, A> (this Task<TryOption<A>> lhs, Task<TryOption<A>> rhs) Source #

where NUM : struct, Num<A>

Add the bound value of Try(x) to Try(y). If either of the Trys are Fail then the result is Fail

Parameters

param lhs

Left-hand side of the operation

param rhs

Right-hand side of the operation

returns

lhs + rhs

method TryOptionAsync<A> Subtract <NUM, A> (this Task<TryOption<A>> lhs, Task<TryOption<A>> rhs) Source #

where NUM : struct, Num<A>

Find the subtract of the bound value of Try(x) and Try(y). If either of the Trys are Fail then the result is Fail

Parameters

param lhs

Left-hand side of the operation

param rhs

Right-hand side of the operation

returns

lhs + rhs

method TryOptionAsync<A> Product <NUM, A> (this Task<TryOption<A>> lhs, Task<TryOption<A>> rhs) Source #

where NUM : struct, Num<A>

Multiply the bound value of Try(x) and Try(y). If either of the Trys are Fail then the result is Fail

Parameters

param lhs

Left-hand side of the operation

param rhs

Right-hand side of the operation

returns

lhs + rhs

method TryOptionAsync<A> Divide <NUM, A> (this Task<TryOption<A>> lhs, Task<TryOption<A>> rhs) Source #

where NUM : struct, Num<A>

Multiply the bound value of Try(x) and Try(y). If either of the Trys are Fail then the result is Fail

Parameters

param lhs

Left-hand side of the operation

param rhs

Right-hand side of the operation

returns

lhs + rhs

method Task<A?> ToNullable <A> (this Task<TryOption<A>> ma) Source #

where A : struct

Convert the Try type to a Nullable of A

Parameters

type A

Type of the bound value

param ma

Try to convert

returns

Nullable of A

delegate TryOption <A> Source #

The Try monad captures exceptions and uses them to cancel the computation. Primarily useful for expression based processing of errors.

To invoke directly, call x.Try()

Parameters

returns

A value that represents the outcome of the computation, either Some, None, or Failure

class TryOptionExtensionsAsync Source #

Extension methods for the Try monad

Methods

method TryOptionAsync<A> ToAsync <A> (this TryOption<A> self) Source #

Converts this TryOption to a TryOptionAsync

Parameters

type A

Bound value type

param self

This

returns

Asynchronous TryOption

method Task<Unit> IfSomeAsync <A> (this TryOption<A> self, Action<A> Some) Source #

Invoke a delegate if the Try returns a value successfully

Parameters

param Some

Delegate to invoke if successful

method Task<Unit> IfNoneOrFailAsync <A> (this TryOption<A> self, Action None) Source #

Invoke a delegate if the Try is in a Fail or None state

Parameters

param None

Delegate to invoke if successful

method Task<A> IfNoneOrFailAsync <A> (this TryOption<A> self, A defaultValue) Source #

Return a default value if the Try fails

Parameters

param defaultValue

Default value to use on failure

returns

failValue on failure, the result of the Try otherwise

method Task<A> IfNoneOrFailAsync <A> (this TryOption<A> self, Func<A> None) Source #

Invoke a delegate if the Try fails

Parameters

param None

Delegate to invoke on failure

returns

Result of the invocation of Fail on failure, the result of the Try otherwise

method Task<A> IfNoneOrFailAsync <A> (this TryOption<A> self, Func<Task<A>> None) Source #

Invoke a delegate if the Try fails

Parameters

param None

Delegate to invoke on failure

returns

Result of the invocation of Fail on failure, the result of the Try otherwise

method Task<A> IfNoneOrFailAsync <A> ( this TryOption<A> self, Func<A> None, Func<Exception, A> Fail) Source #

Invoke delegates based on None or Failed stateds

Parameters

type T

Bound value type

param self

Try computation

param None

Delegate to invoke if the result is None

param Fail

Delegate to invoke if the result is Fail

returns

Success value, or the result of the None or Failed delegate

method Task<A> IfNoneOrFailAsync <A> ( this TryOption<A> self, Func<Task<A>> None, Func<Exception, A> Fail) Source #

Invoke delegates based on None or Failed stateds

Parameters

type T

Bound value type

param self

Try computation

param None

Delegate to invoke if the result is None

param Fail

Delegate to invoke if the result is Fail

returns

Success value, or the result of the None or Failed delegate

method Task<A> IfNoneOrFailAsync <A> ( this TryOption<A> self, Func<A> None, Func<Exception, Task<A>> Fail) Source #

Invoke delegates based on None or Failed stateds

Parameters

type T

Bound value type

param self

Try computation

param None

Delegate to invoke if the result is None

param Fail

Delegate to invoke if the result is Fail

returns

Success value, or the result of the None or Failed delegate

method Task<A> IfNoneOrFailAsync <A> ( this TryOption<A> self, Func<Task<A>> None, Func<Exception, Task<A>> Fail) Source #

Invoke delegates based on None or Failed stateds

Parameters

type T

Bound value type

param self

Try computation

param None

Delegate to invoke if the result is None

param Fail

Delegate to invoke if the result is Fail

returns

Success value, or the result of the None or Failed delegate

method ExceptionMatchOptionalAsync<A> IfFailAsync <A> (this TryOption<A> self) Source #

Provides a fluent exception matching interface which is invoked when the Try fails.

Parameters

returns

Fluent exception matcher

method Task<Unit> IfFailAsync (this TryOption<Exception> self, Action<Exception> Fail) Source #

Invoke a delegate if failed

Parameters

param self

The TryOption computation

param Fail

The delegate to invoke if the TryOption computation fails

returns

method Task<R> MatchAsync <A, R> (this TryOption<A> self, Func<A, R> Succ, Func<R> Fail) Source #

Pattern matches the two possible states of the Try computation

Parameters

type R

Type of the resulting bound value

param Succ

Delegate to invoke if the Try computation completes successfully

param Fail

Delegate to invoke if the Try computation fails

returns

The result of either the Succ or Fail delegates

method Task<R> MatchAsync <A, R> (this TryOption<A> self, Func<A, R> Some, Func<R> None, Func<Exception, R> Fail) Source #

Pattern matches the two possible states of the Try computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the Try computation completes successfully

param Fail

Delegate to invoke if the Try computation fails

returns

The result of either the Succ or Fail delegates

method Task<R> MatchAsync <A, R> (this TryOption<A> self, Func<A, R> Succ, R Fail) Source #

Pattern matches the two possible states of the Try computation

Parameters

type R

Type of the resulting bound value

param Succ

Delegate to invoke if the Try computation completes successfully

param Fail

Default value to use if the Try computation fails

returns

The result of either the Succ delegate or the Fail value

method Task<Unit> MatchAsync <A> (this TryOption<A> self, Action<A> Succ, Action Fail) Source #

Pattern matches the two possible states of the Try computation

Parameters

param Succ

Delegate to invoke if the Try computation completes successfully

param Fail

Delegate to invoke if the Try computation fails

method Task<Unit> MatchAsync <A> (this TryOption<A> self, Action<A> Some, Action None, Action<Exception> Fail) Source #

Pattern matches the two possible states of the Try computation

Parameters

param Some

Delegate to invoke if the Try computation completes successfully

param Fail

Delegate to invoke if the Try computation fails

method Task<R> MatchAsync <A, R> (this TryOption<A> self, Func<A, Task<R>> Some, Func<R> None, Func<Exception, R> Fail) Source #

Pattern matches the three possible states of the computation computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the computation completes successfully

param None

Delegate to invoke if the computation completes successfully but returns no value

param Fail

Delegate to invoke if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> MatchAsync <A, R> (this TryOption<A> self, Func<A, Task<R>> Succ, Func<Task<R>> Fail) Source #

Pattern matches the three possible states of the computation computation

Parameters

type R

Type of the resulting bound value

param Succ

Delegate to invoke if the computation completes successfully

param Fail

Delegate to invoke if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> MatchAsync <A, R> (this TryOption<A> self, Func<A, Task<R>> Some, Func<Task<R>> None, Func<Exception, Task<R>> Fail) Source #

Pattern matches the three possible states of the computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the computation completes successfully

param None

Delegate to invoke if the computation completes successfully but returns no value

param Fail

Delegate to invoke if the computation fails

returns

The result of either the Some, None, or Fail delegate

method Task<R> MatchAsync <A, R> (this TryOption<A> self, Func<A, R> Succ, Func<Task<R>> Fail) Source #

Pattern matches the three possible states of the computation computation

Parameters

type R

Type of the resulting bound value

param Succ

Delegate to invoke if the computation completes successfully

param Fail

Delegate to invoke if the computation fails

returns

The result of either the Succ, Fail delegate

method Task<R> MatchAsync <A, R> (this TryOption<A> self, Func<A, R> Some, Func<Task<R>> None, Func<Exception, Task<R>> Fail) Source #

Pattern matches the three possible states of the computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the computation completes successfully

param None

Delegate to invoke if the computation completes successfully but returns no value

param Fail

Delegate to invoke if the computation fails

returns

The result of either the Some, None, or Fail delegate

method Task<Option<A>> ToOptionAsync <A> (this TryOption<A> self) Source #

method Task<OptionUnsafe<A>> ToOptionUnsafeAsync <A> (this TryOption<A> self) Source #

method Task<Either<Exception, Option<A>>> ToEitherAsync <A> (this TryOption<A> self) Source #

method Task<EitherUnsafe<Exception, Option<A>>> ToEitherUnsafeAsync <A> (this TryOption<A> self) Source #

method Task<A> IfFailThrowAsync <A> (this TryOption<A> self) Source #

method TryOptionAsync<U> Select <A, U> (this TryOption<A> self, Func<A, Task<U>> select) Source #

method Task<Unit> IterAsync <A> (this TryOption<A> self, Action<A> action) Source #

Apply Try values to a Try function of arity 2

Parameters

param self

Try function

param arg1

Try argument

param arg2

Try argument

returns

Returns the result of applying the Try arguments to the Try function

method Task<int> CountAsync <A> (this TryOption<A> self) Source #

Counts the number of bound values.

Parameters

type T

Type of the bound value

param self

TrTry computation

returns

1 if the Try computation is successful, 0 otherwise.

method Task<bool> ForAllAsync <A> (this TryOption<A> self, Func<A, bool> pred) Source #

Tests that a predicate holds for all values of the bound value T

Parameters

type T

Type of the bound value

param self

Try computation

param pred

Predicate to test the bound value against

returns

True if the predicate holds for the bound value, or if the Try computation fails. False otherwise.

method Task<bool> ForAllAsync <A> (this TryOption<A> self, Func<A, Task<bool>> pred) Source #

Tests that a predicate holds for all values of the bound value T

Parameters

type T

Type of the bound value

param self

Try computation

param pred

Predicate to test the bound value against

returns

True if the predicate holds for the bound value, or if the Try computation fails. False otherwise.

method Task<S> FoldAsync <A, S> (this TryOption<A> self, S state, Func<S, A, S> folder) Source #

Parameters

param self

Try to fold

param state

Initial state

param folder

Fold function

returns

Folded state

method Task<S> FoldAsync <A, S> (this TryOption<A> self, S state, Func<S, A, Task<S>> folder) Source #

Parameters

param self

Try to fold

param state

Initial state

param folder

Fold function

returns

Folded state

method Task<S> BiFoldAsync <A, S> (this TryOption<A> self, S state, Func<S, A, S> Succ, Func<S, S> Fail) Source #

Parameters

param self

Try to fold

param state

Initial state

param Succ

Fold function for Success

param Fail

Fold function for Failure

returns

Folded state

method Task<S> BiFoldAsync <A, S> (this TryOption<A> self, S state, Func<S, A, Task<S>> Succ, Func<S, S> Fail) Source #

Parameters

param self

Try to fold

param state

Initial state

param Succ

Fold function for Success

param Fail

Fold function for Failure

returns

Folded state

method Task<S> BiFoldAsync <A, S> (this TryOption<A> self, S state, Func<S, A, S> Succ, Func<S, Task<S>> Fail) Source #

Parameters

param self

Try to fold

param state

Initial state

param Succ

Fold function for Success

param Fail

Fold function for Failure

returns

Folded state

method Task<S> BiFoldAsync <A, S> (this TryOption<A> self, S state, Func<S, A, Task<S>> Succ, Func<S, Task<S>> Fail) Source #

Parameters

param self

Try to fold

param state

Initial state

param Succ

Fold function for Success

param Fail

Fold function for Failure

returns

Folded state

method Task<S> TriFoldAsync <A, S> (this TryOption<A> self, S state, Func<S, A, S> Some, Func<S, S> None, Func<S, Exception, S> Fail) Source #

Parameters

param self

Try to fold

param state

Initial state

param Some

Fold function for Success

param None

Fold function for None

param Fail

Fold function for Failure

returns

Folded state

method Task<S> TriFoldAsync <A, S> (this TryOption<A> self, S state, Func<S, A, Task<S>> Some, Func<S, S> None, Func<S, Exception, S> Fail) Source #

Parameters

param self

Try to fold

param state

Initial state

param Some

Fold function for Success

param None

Fold function for None

param Fail

Fold function for Failure

returns

Folded state

method Task<S> TriFoldAsync <A, S> (this TryOption<A> self, S state, Func<S, A, S> Some, Func<S, Task<S>> None, Func<S, Exception, S> Fail) Source #

Parameters

param self

Try to fold

param state

Initial state

param Some

Fold function for Success

param None

Fold function for None

param Fail

Fold function for Failure

returns

Folded state

method Task<S> TriFoldAsync <A, S> (this TryOption<A> self, S state, Func<S, A, S> Some, Func<S, S> None, Func<S, Exception, Task<S>> Fail) Source #

Parameters

param self

Try to fold

param state

Initial state

param Some

Fold function for Success

param None

Fold function for None

param Fail

Fold function for Failure

returns

Folded state

method Task<S> TriFoldAsync <A, S> (this TryOption<A> self, S state, Func<S, A, Task<S>> Some, Func<S, Task<S>> None, Func<S, Exception, S> Fail) Source #

Parameters

param self

Try to fold

param state

Initial state

param Some

Fold function for Success

param None

Fold function for None

param Fail

Fold function for Failure

returns

Folded state

method Task<S> TriFoldAsync <A, S> (this TryOption<A> self, S state, Func<S, A, S> Some, Func<S, Task<S>> None, Func<S, Exception, Task<S>> Fail) Source #

Parameters

param self

Try to fold

param state

Initial state

param Some

Fold function for Success

param None

Fold function for None

param Fail

Fold function for Failure

returns

Folded state

method Task<S> TriFoldAsync <A, S> (this TryOption<A> self, S state, Func<S, A, Task<S>> Some, Func<S, Task<S>> None, Func<S, Exception, Task<S>> Fail) Source #

Parameters

param self

Try to fold

param state

Initial state

param Some

Fold function for Success

param None

Fold function for None

param Fail

Fold function for Failure

returns

Folded state

method Task<bool> ExistsAsync <A> (this TryOption<A> self, Func<A, bool> pred) Source #

Tests that a predicate holds for any value of the bound value T

Parameters

type A

Type of the bound value

param self

Try computation

param pred

Predicate to test the bound value against

returns

True if the predicate holds for the bound value. False otherwise.

method Task<bool> ExistsAsync <A> (this TryOption<A> self, Func<A, Task<bool>> pred) Source #

Tests that a predicate holds for any value of the bound value T

Parameters

type A

Type of the bound value

param self

Try computation

param pred

Predicate to test the bound value against

returns

True if the predicate holds for the bound value. False otherwise.

method TryOptionAsync<R> MapAsync <A, R> (this TryOption<A> self, Func<A, R> mapper) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type R

Resulting bound value type

param self

Try computation

param mapper

Delegate to map the bound value

returns

Mapped Try computation

method TryOptionAsync<R> MapAsync <A, R> (this TryOption<A> self, Func<A, Task<R>> mapper) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type R

Resulting bound value type

param self

Try computation

param mapper

Delegate to map the bound value

returns

Mapped Try computation

method TryOptionAsync<B> BiMapAsync <A, B> (this TryOption<A> self, Func<A, B> Succ, Func<B> Fail) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param Succ

Delegate to map the bound value

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped computation

method TryOptionAsync<B> BiMapAsync <A, B> (this TryOption<A> self, Func<A, Task<B>> Succ, Func<B> Fail) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param Succ

Delegate to map the bound value

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped computation

method TryOptionAsync<B> BiMapAsync <A, B> (this TryOption<A> self, Func<A, B> Succ, Func<Task<B>> Fail) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param Succ

Delegate to map the bound value

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped computation

method TryOptionAsync<B> BiMapAsync <A, B> (this TryOption<A> self, Func<A, Task<B>> Succ, Func<Task<B>> Fail) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param Succ

Delegate to map the bound value

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped computation

method TryOptionAsync<B> TriMapAsync <A, B> (this TryOption<A> self, Func<A, B> Some, Func<B> None, Func<Exception, B> Fail) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param Some

Delegate to map the bound value

param None

Delegate to map the None to the desired bound result type

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped computation

method TryOptionAsync<B> TriMapAsync <A, B> (this TryOption<A> self, Func<A, Task<B>> Some, Func<B> None, Func<Exception, B> Fail) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param Some

Delegate to map the bound value

param None

Delegate to map the None to the desired bound result type

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped computation

method TryOptionAsync<B> TriMapAsync <A, B> (this TryOption<A> self, Func<A, B> Some, Func<Task<B>> None, Func<Exception, B> Fail) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param Some

Delegate to map the bound value

param None

Delegate to map the None to the desired bound result type

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped computation

method TryOptionAsync<B> TriMapAsync <A, B> (this TryOption<A> self, Func<A, B> Some, Func<B> None, Func<Exception, Task<B>> Fail) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param Some

Delegate to map the bound value

param None

Delegate to map the None to the desired bound result type

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped computation

method TryOptionAsync<B> TriMapAsync <A, B> (this TryOption<A> self, Func<A, Task<B>> Some, Func<Task<B>> None, Func<Exception, B> Fail) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param Some

Delegate to map the bound value

param None

Delegate to map the None to the desired bound result type

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped computation

method TryOptionAsync<B> TriMapAsync <A, B> (this TryOption<A> self, Func<A, B> Some, Func<Task<B>> None, Func<Exception, Task<B>> Fail) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param Some

Delegate to map the bound value

param None

Delegate to map the None to the desired bound result type

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped computation

method TryOptionAsync<B> TriMapAsync <A, B> (this TryOption<A> self, Func<A, Task<B>> Some, Func<Task<B>> None, Func<Exception, Task<B>> Fail) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param Some

Delegate to map the bound value

param None

Delegate to map the None to the desired bound result type

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped computation

method TryOptionAsync<A> FilterAsync <A> (this TryOption<A> self, Func<A, bool> pred) Source #

method TryOptionAsync<A> FilterAsync <A> (this TryOption<A> self, Func<A, Task<bool>> pred) Source #

method TryOptionAsync<A> WhereAsync <A> (this TryOption<A> self, Func<A, bool> pred) Source #

method TryOptionAsync<A> WhereAsync <A> (this TryOption<A> self, Func<A, Task<bool>> pred) Source #

method Task<Seq<A>> ToSeqAsync <A> (this TryOption<A> self) Source #

method Task<Seq<A>> AsEnumerableAsync <A> (this TryOption<A> self) Source #

method Task<Lst<A>> ToListAsync <A> (this TryOption<A> self) Source #

method Task<Arr<A>> ToArrayAsync <A> (this TryOption<A> self) Source #

method Task<string> AsStringAsync <A> (this TryOption<A> self) Source #

method Task<int> SumAsync (this TryOption<int> self) Source #

method TryOptionAsync<A> AddAsync <NUM, A> (this TryOption<A> lhs, TryOption<A> rhs) Source #

where NUM : struct, Num<A>

Add the bound value of Try(x) to Try(y). If either of the Trys are Fail then the result is Fail

Parameters

param lhs

Left-hand side of the operation

param rhs

Right-hand side of the operation

returns

lhs + rhs

method TryOptionAsync<A> SubtractAsync <NUM, A> (this TryOption<A> lhs, TryOption<A> rhs) Source #

where NUM : struct, Num<A>

Find the subtract of the bound value of Try(x) and Try(y). If either of the Trys are Fail then the result is Fail

Parameters

param lhs

Left-hand side of the operation

param rhs

Right-hand side of the operation

returns

lhs + rhs

method TryOptionAsync<A> ProductAsync <NUM, A> (this TryOption<A> lhs, TryOption<A> rhs) Source #

where NUM : struct, Num<A>

Multiply the bound value of Try(x) and Try(y). If either of the Trys are Fail then the result is Fail

Parameters

param lhs

Left-hand side of the operation

param rhs

Right-hand side of the operation

returns

lhs + rhs

method TryOptionAsync<A> DivideAsync <NUM, A> (this TryOption<A> lhs, TryOption<A> rhs) Source #

where NUM : struct, Num<A>

Multiply the bound value of Try(x) and Try(y). If either of the Trys are Fail then the result is Fail

Parameters

param lhs

Left-hand side of the operation

param rhs

Right-hand side of the operation

returns

lhs + rhs

method Task<A?> ToNullableAsync <A> (this TryOption<A> ma) Source #

where A : struct

Convert the Try type to a Nullable of A

Parameters

type A

Type of the bound value

param ma

Try to convert

returns

Nullable of A

class TryOptionExtensions Source #

Extension methods for the Try monad

Methods

method object Case <A> (this TryOption<A> ma) Source #

Use for pattern-matching the case of the target

TryOption Some = result is A
TryOption None = result is null
TryOption Fail = result is LanguageExt.Common.Error

method TryOption<A> Memo <A> (this TryOption<A> ma) Source #

Memoize the computation so that it's only run once

method TryOption<A> Retry <A> (TryOption<A> ma, int amount = 3) Source #

If the TryOption fails, retry amount times

Parameters

type A

Type of bound value

param ma

TryOption

param amount

Amount of retries

returns

TryOption

method TryOption<A> Strict <A> (this TryOption<A> ma) Source #

Forces evaluation of the lazy TryOption

Parameters

type A

Bound value type

param ma

Computation to evaluate

returns

The TryOption with the computation executed

method bool IsSome <A> (this TryOption<A> ma) Source #

Test if the TryOption is in a success state

Parameters

type A

Bound value type

param ma

Computation to evaluate

returns

True if computation has succeeded

method bool IsFail <A> (this TryOption<A> ma) Source #

Test if the TryOption is in a Fail state

Parameters

type A

Bound value type

param ma

Computation to evaluate

returns

True if computation is faulted

method bool IsNoneOrFail <A> (this TryOption<A> ma) Source #

Test if the TryOption is in a None or Fail state

Parameters

type A

Bound value type

param ma

Computation to evaluate

returns

True if computation is faulted

method bool IsNone <A> (this TryOption<A> ma) Source #

Test if the TryOption is in a None state

Parameters

type A

Bound value type

param ma

Computation to evaluate

returns

True if computation is faulted

method Unit IfSome <A> (this TryOption<A> self, Action<A> Some) Source #

Invoke a delegate if the Try returns a value successfully

Parameters

param Some

Delegate to invoke if successful

method Unit IfNoneOrFail <A> (this TryOption<A> self, Action None) Source #

Invoke a delegate if the Try is in a Fail or None state

Parameters

param None

Delegate to invoke if successful

method A IfNoneOrFail <A> (this TryOption<A> self, A defaultValue) Source #

Return a default value if the Try fails

Parameters

param defaultValue

Default value to use on failure

returns

failValue on failure, the result of the Try otherwise

method A IfNoneOrFail <A> (this TryOption<A> self, Func<A> None) Source #

Invoke a delegate if the Try fails

Parameters

param None

Delegate to invoke on failure

returns

Result of the invocation of Fail on failure, the result of the Try otherwise

method A IfNoneOrFail <A> ( this TryOption<A> self, Func<A> None, Func<Exception, A> Fail) Source #

Invoke delegates based on None or Failed stateds

Parameters

type T

Bound value type

param self

Try computation

param None

Delegate to invoke if the result is None

param Fail

Delegate to invoke if the result is Fail

returns

Success value, or the result of the None or Failed delegate

method ExceptionMatch<Option<A>> IfFail <A> (this TryOption<A> self) Source #

Provides a fluent exception matching interface which is invoked when the Try fails.

Parameters

returns

Fluent exception matcher

method Unit IfFail <A> (this TryOption<A> self, Action<Exception> Fail) Source #

Invoke a delegate if the Try fails

Parameters

type A

Type of bound value

param self

TryOption computation

param Fail

Delegate to run on failure

returns

method R Match <A, R> (this TryOption<A> self, Func<A, R> Some, Func<R> Fail) Source #

Pattern matches the two possible states of the Try computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the Try computation completes successfully

param Fail

Delegate to invoke if the Try computation fails

returns

The result of either the Succ or Fail delegates

method R Match <A, R> (this TryOption<A> self, Func<A, R> Some, Func<R> None, Func<Exception, R> Fail) Source #

Pattern matches the two possible states of the Try computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the Try computation completes successfully

param Fail

Delegate to invoke if the Try computation fails

returns

The result of either the Succ or Fail delegates

method R Match <A, R> (this TryOption<A> self, Func<A, R> Some, R Fail) Source #

Pattern matches the two possible states of the Try computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the Try computation completes successfully

param Fail

Default value to use if the Try computation fails

returns

The result of either the Succ delegate or the Fail value

method Unit Match <A> (this TryOption<A> self, Action<A> Some, Action Fail) Source #

Pattern matches the two possible states of the Try computation

Parameters

param Some

Delegate to invoke if the Try computation completes successfully

param Fail

Delegate to invoke if the Try computation fails

method Unit Match <A> (this TryOption<A> self, Action<A> Some, Action None, Action<Exception> Fail) Source #

Pattern matches the two possible states of the Try computation

Parameters

param Some

Delegate to invoke if the Try computation completes successfully

param Fail

Delegate to invoke if the Try computation fails

method Eff<A> ToEff <A> (this TryOption<A> ma) Source #

Convert the structure to an Eff

Parameters

returns

An Eff representation of the structure

method Eff<A> ToEff <A> (this TryOption<A> ma, Error None) Source #

Convert the structure to an Eff

Parameters

returns

An Eff representation of the structure

method Eff<A> ToEff <A> (this TryOption<A> ma, Func<Error> None) Source #

Convert the structure to an Eff

Parameters

returns

An Eff representation of the structure

method Eff<A> ToEff <A> (this TryOption<A> ma, A None) Source #

Convert the structure to an Eff

Parameters

returns

An Eff representation of the structure

method Eff<A> ToEff <A> (this TryOption<A> ma, Func<A> None) Source #

Convert the structure to an Eff

Parameters

returns

An Eff representation of the structure

method Aff<A> ToAff <A> (this TryOption<A> ma) Source #

Convert the structure to an Aff

Parameters

returns

An Aff representation of the structure

method Aff<A> ToAff <A> (this TryOption<A> ma, Error None) Source #

Convert the structure to an Aff

Parameters

returns

An Aff representation of the structure

method Aff<A> ToAff <A> (this TryOption<A> ma, Func<Error> None) Source #

Convert the structure to an Aff

Parameters

returns

An Aff representation of the structure

method Aff<A> ToAff <A> (this TryOption<A> ma, A None) Source #

Convert the structure to an Aff

Parameters

returns

An Aff representation of the structure

method Aff<A> ToAff <A> (this TryOption<A> ma, Func<A> None) Source #

Convert the structure to an Aff

Parameters

returns

An Aff representation of the structure

method Option<A> ToOption <A> (this TryOption<A> self) Source #

method OptionUnsafe<A> ToOptionUnsafe <A> (this TryOption<A> self) Source #

method Validation<Exception, Option<A>> ToValidation <A> (this TryOption<A> self) Source #

method Either<Exception, Option<A>> ToEither <A> (this TryOption<A> self) Source #

method EitherUnsafe<Exception, Option<A>> ToEitherUnsafe <A> (this TryOption<A> self) Source #

method Validation<FAIL, Option<A>> ToValidation <A, FAIL> (this TryOption<A> self, Func<Exception, FAIL> Fail) Source #

method Either<L, Option<A>> ToEither <A, L> (this TryOption<A> self, Func<Exception, L> Fail) Source #

method EitherUnsafe<L, Option<A>> ToEitherUnsafe <A, L> (this TryOption<A> self, Func<Exception, L> Fail) Source #

method Try<Option<A>> ToTry <A> (this TryOption<A> self) Source #

method Try<A> ToTry <A> (this TryOption<A> self, Func<A> None) Source #

method A IfFailThrow <A> (this TryOption<A> self) Source #

method TryOption<B> Select <A, B> (this TryOption<A> self, Func<A, B> select) Source #

method Unit Iter <A> (this TryOption<A> self, Action<A> action) Source #

Apply Try values to a Try function of arity 2

Parameters

param self

Try function

param arg1

Try argument

param arg2

Try argument

returns

Returns the result of applying the Try arguments to the Try function

method int Count <A> (this TryOption<A> self) Source #

Counts the number of bound values.

Parameters

type T

Type of the bound value

param self

TrTry computation

returns

1 if the Try computation is successful, 0 otherwise.

method bool ForAll <A> (this TryOption<A> self, Func<A, bool> pred) Source #

Tests that a predicate holds for all values of the bound value T

Parameters

type T

Type of the bound value

param self

Try computation

param pred

Predicate to test the bound value against

returns

True if the predicate holds for the bound value, or if the Try computation fails. False otherwise.

method S Fold <A, S> (this TryOption<A> self, S state, Func<S, A, S> folder) Source #

Parameters

param self

Try to fold

param state

Initial state

param folder

Fold function

returns

Folded state

method S BiFold <A, S> (this TryOption<A> self, S state, Func<S, A, S> Some, Func<S, S> Fail) Source #

Parameters

param self

Try to fold

param state

Initial state

param Some

Fold function for Success

param Fail

Fold function for Failure

returns

Folded state

method S TriFold <A, S> (this TryOption<A> self, S state, Func<S, A, S> Some, Func<S, S> None, Func<S, Exception, S> Fail) Source #

Parameters

param self

Try to fold

param state

Initial state

param Some

Fold function for Success

param Fail

Fold function for Failure

returns

Folded state

method bool Exists <A> (this TryOption<A> self, Func<A, bool> pred) Source #

Tests that a predicate holds for any value of the bound value T

Parameters

type T

Type of the bound value

param self

Try computation

param pred

Predicate to test the bound value against

returns

True if the predicate holds for the bound value. False otherwise.

method TryOption<A> Do <A> (this TryOption<A> ma, Action<A> f) Source #

Impure iteration of the bound value in the structure

Parameters

returns

Returns the original unmodified structure

method TryOption<B> Map <A, B> (this TryOption<A> self, Func<A, B> f) Source #

Maps the bound value

Parameters

type T

Type of the bound value

type R

Resulting bound value type

param self

Try computation

param mapper

Delegate to map the bound value

returns

Mapped Try computation

method TryOption<R> BiMap <A, R> (this TryOption<A> self, Func<A, R> Some, Func<R> Fail) Source #

Maps the bound value

Parameters

type T

Type of the bound value

type R

Resulting bound value type

param self

Try computation

param Some

Delegate to map the bound value

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped Try computation

method TryOption<R> TriMap <A, R> (this TryOption<A> self, Func<A, R> Some, Func<R> None, Func<Exception, R> Fail) Source #

Maps the bound value

Parameters

type T

Type of the bound value

type R

Resulting bound value type

param self

Try computation

param Some

Delegate to map the bound value

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped Try computation

method TryOption<Func<B, R>> ParMap <A, B, R> (this TryOption<A> self, Func<A, B, R> func) Source #

Partial application map

method TryOption<Func<B, Func<C, R>>> ParMap <A, B, C, R> (this TryOption<A> self, Func<A, B, C, R> func) Source #

Partial application map

method TryOption<A> Filter <A> (this TryOption<A> self, Func<A, bool> pred) Source #

method TryOption<A> Where <A> (this TryOption<A> self, Func<A, bool> pred) Source #

method TryOption<B> Bind <A, B> (this TryOption<A> ma, Func<A, TryOption<B>> f) Source #

method TryOption<R> BiBind <A, R> (this TryOption<A> self, Func<A, TryOption<R>> Some, Func<TryOption<R>> Fail) Source #

method TryOption<R> TriBind <A, R> (this TryOption<A> self, Func<A, TryOption<R>> Some, Func<TryOption<R>> None, Func<Exception, TryOption<R>> Fail) Source #

method Seq<A> ToSeq <A> (this TryOption<A> self) Source #

method Seq<A> AsEnumerable <A> (this TryOption<A> self) Source #

method Lst<A> ToList <A> (this TryOption<A> self) Source #

method Arr<A> ToArray <A> (this TryOption<A> self) Source #

method TryOptionSomeContext<A, R> Some <A, R> (this TryOption<A> self, Func<A, R> Some) Source #

method TryOptionSomeUnitContext<A> Some <A> (this TryOption<A> self, Action<A> Some) Source #

method string AsString <A> (this TryOption<A> self) Source #

method TryOption<C> SelectMany <A, B, C> ( this TryOption<A> ma, Func<A, TryOption<B>> bind, Func<A, B, C> project) Source #

method TryOption<V> Join <A, U, K, V> ( this TryOption<A> self, TryOption<U> inner, Func<A, K> outerKeyMap, Func<U, K> innerKeyMap, Func<A, U, V> project) Source #

method OptionalResult<T> Try <T> (this TryOption<T> self) Source #

Savely invokes the TryOption computation

Parameters

type T

Bound value of the computation

param self

TryOption to invoke

returns

TryOptionResult

method TryOption<U> Use <T, U> (this TryOption<T> self, Func<T, U> select) Source #

where T : IDisposable

method int Sum (this TryOption<int> self) Source #

method Task<R> MatchAsync <T, R> (this Task<TryOption<T>> self, Func<T, R> Some, Func<R> None, Func<Exception, R> Fail) Source #

method Task<R> MatchAsync <T, R> (this Task<TryOption<T>> self, Func<T, R> Some, Func<R> Fail) Source #

method Task<R> MatchAsync <T, R> (this Task<TryOption<T>> self, Func<T, Task<R>> Some, Func<R> Fail) Source #

method TryOption<T> Flatten <T> (this TryOption<TryOption<T>> self) Source #

method TryOption<T> Flatten <T> (this TryOption<TryOption<TryOption<T>>> self) Source #

method TryOption<T> Flatten <T> (this TryOption<TryOption<TryOption<TryOption<T>>>> self) Source #

method TryOption<B> Apply <A, B> (this TryOption<Func<A, B>> fab, TryOption<A> fa) Source #

Apply

Parameters

param fab

Function to apply the applicative to

param fa

Applicative to apply

returns

Applicative of type FB derived from Applicative of B

method TryOption<B> Apply <A, B> (this Func<A, B> fab, TryOption<A> fa) Source #

Apply

Parameters

param fab

Function to apply the applicative to

param fa

Applicative to apply

returns

Applicative of type FB derived from Applicative of B

method TryOption<C> Apply <A, B, C> (this TryOption<Func<A, B, C>> fabc, TryOption<A> fa, TryOption<B> fb) Source #

Apply

Parameters

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 TryOption<C> Apply <A, B, C> (this Func<A, B, C> fabc, TryOption<A> fa, TryOption<B> fb) Source #

Apply

Parameters

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 TryOption<Func<B, C>> Apply <A, B, C> (this TryOption<Func<A, B, C>> fabc, TryOption<A> fa) Source #

Apply

Parameters

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 TryOption<Func<B, C>> Apply <A, B, C> (this Func<A, B, C> fabc, TryOption<A> fa) Source #

Apply

Parameters

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 TryOption<Func<B, C>> Apply <A, B, C> (this TryOption<Func<A, Func<B, C>>> fabc, TryOption<A> fa) Source #

Apply

Parameters

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 TryOption<B> Action <A, B> (this TryOption<A> fa, TryOption<B> fb) Source #

Evaluate fa, then fb, ignoring the result of fa

Parameters

param fa

Applicative to evaluate first

param fb

Applicative to evaluate second and then return

returns

Applicative of type Option

method TryOption<A> Add <ARITH, A> (this TryOption<A> lhs, TryOption<A> rhs) Source #

where ARITH : struct, Arithmetic<A>

Add the bound value of Try(x) to Try(y). If either of the Trys are Fail then the result is Fail

Parameters

param lhs

Left-hand side of the operation

param rhs

Right-hand side of the operation

returns

lhs + rhs

method TryOption<A> Subtract <ARITH, A> (this TryOption<A> lhs, TryOption<A> rhs) Source #

where ARITH : struct, Arithmetic<A>

Find the subtract of the bound value of Try(x) and Try(y). If either of the Trys are Fail then the result is Fail

Parameters

param lhs

Left-hand side of the operation

param rhs

Right-hand side of the operation

returns

lhs + rhs

method TryOption<A> Product <ARITH, A> (this TryOption<A> lhs, TryOption<A> rhs) Source #

where ARITH : struct, Arithmetic<A>

Multiply the bound value of Try(x) and Try(y). If either of the Trys are Fail then the result is Fail

Parameters

param lhs

Left-hand side of the operation

param rhs

Right-hand side of the operation

returns

lhs + rhs

method TryOption<A> Divide <NUM, A> (this TryOption<A> lhs, TryOption<A> rhs) Source #

where NUM : struct, Num<A>

Multiply the bound value of Try(x) and Try(y). If either of the Trys are Fail then the result is Fail

Parameters

param lhs

Left-hand side of the operation

param rhs

Right-hand side of the operation

returns

lhs + rhs

method A? ToNullable <A> (this TryOption<A> ma) Source #

where A : struct

Convert the Try type to a Nullable of A

Parameters

type A

Type of the bound value

param ma

Try to convert

returns

Nullable of A

method TryOption<A> Plus <A> (this TryOption<A> ma, TryOption<A> mb) Source #

class Prelude Source #

Methods

method TryOption<T> TryOption <T> (Func<Option<T>> f) Source #

TryOption constructor

method TryOption<T> TryOption <T> (Func<T> f) Source #

TryOption constructor

method TryOption<T> TryOption <T> (T value) Source #

TryOption constructor

method TryOption<T> TryOptionSucc <T> (T value) Source #

TryOption constructor

method TryOption<T> TryOption <T> (Option<T> value) Source #

TryOption constructor

method TryOption<T> TryOptional <T> (Option<T> value) Source #

TryOption constructor

method TryOption<T> TryOption <T> (Exception ex) Source #

TryOption constructor

method TryOption<T> TryOptionFail <T> (Exception ex) Source #

TryOption constructor

method TryOption<A> add <NUM, A> (TryOption<A> lhs, TryOption<A> rhs) Source #

where NUM : struct, Num<A>

Add the bound value of Try(x) to Try(y). If either of the Trys are Fail then the result is Fail

Parameters

param lhs

Left-hand side of the operation

param rhs

Right-hand side of the operation

returns

lhs + rhs

method TryOption<T> subtract <NUM, T> (TryOption<T> lhs, TryOption<T> rhs) Source #

where NUM : struct, Num<T>

Subtract the Try(x) from Try(y). If either of the Trys throw then the result is Fail For numeric values the behaviour is to find the subtract between the Trys (lhs - rhs) For Lst values the behaviour is to remove items in the rhs from the lhs For Map or Set values the behaviour is to remove items in the rhs from the lhs Otherwise if the R type derives from ISubtractable then the behaviour is to call lhs.Subtract(rhs);

Parameters

param lhs

Left-hand side of the operation

param rhs

Right-hand side of the operation

returns

lhs - rhs

method TryOption<T> product <NUM, T> (TryOption<T> lhs, TryOption<T> rhs) Source #

where NUM : struct, Num<T>

Find the product of Try(x) and Try(y). If either of the Trys throw then the result is Fail For numeric values the behaviour is to multiply the Trys (lhs * rhs) For Lst values the behaviour is to multiply all combinations of values in both lists to produce a new list Otherwise if the R type derives from IMultiplicable then the behaviour is to call lhs.Multiply(rhs);

Parameters

param lhs

Left-hand side of the operation

param rhs

Right-hand side of the operation

returns

lhs * rhs

method TryOption<T> divide <NUM, T> (TryOption<T> lhs, TryOption<T> rhs) Source #

where NUM : struct, Num<T>

Divide Try(x) by Try(y). If either of the Trys throw then the result is Fail For numeric values the behaviour is to divide the Trys (lhs / rhs) For Lst values the behaviour is to divide all combinations of values in both lists to produce a new list Otherwise if the R type derives from IDivisible then the behaviour is to call lhs.Divide(rhs);

Parameters

param lhs

Left-hand side of the operation

param rhs

Right-hand side of the operation

returns

lhs / rhs

method TryOption<B> apply <A, B> (TryOption<Func<A, B>> fab, TryOption<A> fa) Source #

Apply

Parameters

param fab

Function to apply the applicative to

param fa

Applicative to apply

returns

Applicative of type FB derived from Applicative of B

method TryOption<B> apply <A, B> (Func<A, B> fab, TryOption<A> fa) Source #

Apply

Parameters

param fab

Function to apply the applicative to

param fa

Applicative to apply

returns

Applicative of type FB derived from Applicative of B

method TryOption<C> apply <A, B, C> (TryOption<Func<A, B, C>> fabc, TryOption<A> fa, TryOption<B> fb) Source #

Apply

Parameters

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 TryOption<C> apply <A, B, C> (Func<A, B, C> fabc, TryOption<A> fa, TryOption<B> fb) Source #

Apply

Parameters

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 TryOption<Func<B, C>> apply <A, B, C> ( TryOption<Func<A, B, C>> fabc, TryOption<A> fa) Source #

Apply

Parameters

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 TryOption<Func<B, C>> apply <A, B, C> (Func<A, B, C> fabc, TryOption<A> fa) Source #

Apply

Parameters

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 TryOption<Func<B, C>> apply <A, B, C> (TryOption<Func<A, Func<B, C>>> fabc, TryOption<A> fa) Source #

Apply

Parameters

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 TryOption<Func<B, C>> apply <A, B, C> (Func<A, Func<B, C>> fabc, TryOption<A> fa) Source #

Apply

Parameters

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 TryOption<B> action <A, B> (TryOption<A> fa, TryOption<B> fb) Source #

Evaluate fa, then fb, ignoring the result of fa

Parameters

param fa

Applicative to evaluate first

param fb

Applicative to evaluate second and then return

returns

Applicative of type Option

method bool isSome <T> (TryOption<T> self) Source #

Test if the Try computation is successful

Parameters

type T

Type of the bound value

param self

Try computation to test

returns

True if successful

method bool isNone <T> (TryOption<T> self) Source #

Test if the Try computation is none

Parameters

type T

Type of the bound value

param self

Try computation to test

returns

True if result is a None

method bool isFail <T> (TryOption<T> self) Source #

Test if the Try computation fails

Parameters

type T

Type of the bound value

param self

Try computation to test

returns

True if fails

method T ifNoneOrFail <T> ( TryOption<T> self, Func<T> None, Func<Exception, T> Fail) Source #

Invoke delegates based on None or Failed stateds

Parameters

type T

Bound value type

param self

Try computation

param None

Delegate to invoke if the result is None

param Fail

Delegate to invoke if the result is Fail

returns

Success value, or the result of the None or Failed delegate

method Unit ifSome <T> (TryOption<T> self, Action<T> Some) Source #

Invoke a delegate if the Try returns a value successfully

Parameters

type T

Type of the bound value

param self

Try computation

param Some

Delegate to invoke if successful

method T ifNoneOrFail <T> (TryOption<T> self, Func<T> Fail) Source #

Invoke a delegate if the Try fails

Parameters

type T

Type of the bound value

param value

Try computation

param Fail

Delegate to invoke on failure

returns

Result of the invocation of Fail on failure, the result of the Try otherwise

method T ifNoneOrFail <T> (TryOption<T> self, T defaultValue) Source #

Return a default value if the Try fails

Parameters

type T

Type of the bound value

param self

Try computation

param defaultValue

Default value to use on failure

returns

failValue on failure, the result of the Try otherwise

method ExceptionMatch<Option<T>> ifFail <T> (TryOption<T> self) Source #

Provides a fluent exception matching interface which is invoked when the Try fails.

Parameters

type T

Type of the bound value

param self

Try computation

returns

Fluent exception matcher

method Unit iffFail <T> (TryOption<T> self, Action<Exception> Fail) Source #

Invoke a delegate if the TryOption fails

Parameters

type T

Type of bound value

param self

TryOption computation

param Fail

Delegate to invoke if the TryOption computation fails

method TryOption<Exception> failed <T> (TryOption<T> self) Source #

Maps the bound value to the resulting exception (if the Try computation fails). If the Try computation succeeds then a NotSupportedException is used.

Parameters

type T

Type of the bound value

param self

Try computation

returns

Try of Exception

method TryOption<T> flatten <T> (TryOption<TryOption<T>> self) Source #

Flattens nested Try computations

Parameters

type T

Type of the bound value

param self

Try computation

returns

Flattened Try computation

method TryOption<T> flatten <T> (TryOption<TryOption<TryOption<T>>> self) Source #

Flattens nested Try computations

Parameters

type T

Type of the bound value

param self

Try computation

returns

Flattened Try computation

method TryOption<T> flatten <T> (TryOption<TryOption<TryOption<TryOption<T>>>> self) Source #

Flattens nested Try computations

Parameters

type T

Type of the bound value

param self

Try computation

returns

Flattened Try computation

method R match <T, R> (TryOption<T> self, Func<T, R> Some, Func<R> Fail) Source #

Pattern matches the two possible states of the Try computation

Parameters

type T

Type of the bound value

type R

Type of the resulting bound value

param self

Try computation

param Some

Delegate to invoke if the Try computation completes successfully

param Fail

Delegate to invoke if the Try computation fails

returns

The result of either the Some or Fail delegates

method R match <T, R> (TryOption<T> self, Func<T, R> Some, Func<R> None, Func<Exception, R> Fail) Source #

Pattern matches the two possible states of the Try computation

Parameters

type T

Type of the bound value

type R

Type of the resulting bound value

param self

Try computation

param Some

Delegate to invoke if the Try computation completes successfully

param Fail

Delegate to invoke if the Try computation fails

returns

The result of either the Some or Fail delegates

method R match <T, R> (TryOption<T> self, Func<T, R> Some, R Fail) Source #

Pattern matches the two possible states of the Try computation

Parameters

type T

Type of the bound value

type R

Type of the resulting bound value

param self

Try computation

param Some

Delegate to invoke if the Try computation completes successfully

param Fail

Default value to use if the Try computation fails

returns

The result of either the Succ delegate or the Fail value

method Unit match <T> (TryOption<T> self, Action<T> Some, Action Fail) Source #

Pattern matches the two possible states of the Try computation

Parameters

type T

Type of the bound value

param self

Try computation

param Some

Delegate to invoke if the Try computation completes successfully

param Fail

Delegate to invoke if the Try computation fails

method Unit match <T> (TryOption<T> self, Action<T> Some, Action None, Action<Exception> Fail) Source #

Pattern matches the two possible states of the Try computation

Parameters

type T

Type of the bound value

param self

Try computation

param Some

Delegate to invoke if the Try computation completes successfully

param Fail

Delegate to invoke if the Try computation fails

method Unit iter <T> (TryOption<T> self, Action<T> action) Source #

Invokes a delegate with the result of the Try computation if it is successful.

Parameters

type T

Type of the bound value

param self

Try computation

param action

Delegate to invoke on successful invocation of the Try computation

method S fold <S, T> (TryOption<T> self, S state, Func<S, T, S> folder) Source #

Parameters

param self

Try to fold

param state

Initial state

param folder

Fold function

returns

Folded state

method S bifold <S, T> (TryOption<T> self, S state, Func<S, T, S> Some, Func<S, S> Fail) Source #

Parameters

param tryDel

Try to fold

param state

Initial state

param Some

Fold function when Try succeeds

param Fail

Fold function when Try fails

returns

Folded state

method S trifold <S, T> (TryOption<T> self, S state, Func<S, T, S> Some, Func<S, S> None, Func<S, Exception, S> Fail) Source #

Parameters

param tryDel

Try to fold

param state

Initial state

param Some

Fold function when Try succeeds

param Fail

Fold function when Try fails

returns

Folded state

method bool forall <T> (TryOption<T> self, Func<T, bool> pred) Source #

Tests that a predicate holds for all values of the bound value T

Parameters

type T

Type of the bound value

param self

Try computation

param pred

Predicate to test the bound value against

returns

True if the predicate holds for the bound value, or if the Try computation fails. False otherwise.

method int count <T> (TryOption<T> self) Source #

Counts the number of bound values.

Parameters

type T

Type of the bound value

param self

TrTry computation

returns

1 if the Try computation is successful, 0 otherwise.

method bool exists <T> (TryOption<T> self, Func<T, bool> pred) Source #

Tests that a predicate holds for any value of the bound value T

Parameters

type T

Type of the bound value

param self

Try computation

param pred

Predicate to test the bound value against

returns

True if the predicate holds for the bound value. False otherwise.

method TryOption<R> map <T, R> (TryOption<T> self, Func<T, R> mapper) Source #

Maps the bound value

Parameters

type T

Type of the bound value

type R

Resulting bound value type

param self

Try computation

param mapper

Delegate to map the bound value

returns

Mapped Try computation

method TryOption<R> bimap <T, R> (TryOption<T> tryDel, Func<T, R> Some, Func<R> Fail) Source #

Maps the bound value

Parameters

type T

Type of the bound value

type R

Resulting bound value type

param self

Try computation

param Some

Delegate to map the bound value

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped Try computation

method TryOption<R> trimap <T, R> (TryOption<T> tryDel, Func<T, R> Some, Func<R> None, Func<Exception, R> Fail) Source #

Maps the bound value

Parameters

type T

Type of the bound value

type R

Resulting bound value type

param self

Try computation

param Some

Delegate to map the bound value

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped Try computation

method TryOption<Func<T2, R>> parmap <T1, T2, R> (TryOption<T1> self, Func<T1, T2, R> func) Source #

Partial application map

method TryOption<Func<T2, Func<T3, R>>> parmap <T1, T2, T3, R> (TryOption<T1> self, Func<T1, T2, T3, R> func) Source #

Partial application map

method TryOption<T> filter <T> (TryOption<T> self, Func<T, bool> pred) Source #

method TryOption<R> bind <T, R> (TryOption<T> tryDel, Func<T, TryOption<R>> binder) Source #

method TryOption<R> bibind <T, R> (TryOption<T> self, Func<T, TryOption<R>> Some, Func<TryOption<R>> Fail) Source #

method TryOption<R> tribind <T, R> (TryOption<T> self, Func<T, TryOption<R>> Some, Func<TryOption<R>> None, Func<Exception, TryOption<R>> Fail) Source #

method Lst<T> toList <T> (TryOption<T> tryDel) Source #

method Arr<T> toArray <T> (TryOption<T> tryDel) Source #

method TryOption<T> tryfun <T> (Func<TryOption<T>> tryDel) Source #

method TryOption<A> choice <A> (TryOption<A> ma, params TryOption<A>[] tail) Source #

Returns the first successful computation

Parameters

type A

Bound value

param ma

The first computation to run

param tail

The rest of the computations to run

returns

The first computation that succeeds

method TryOption<A> choice <A> (Seq<TryOption<A>> xs) Source #

Returns the first successful computation

Parameters

type A

Bound value

param xs

Sequence of computations to run

returns

The first computation that succeeds

struct TryOptionSomeContext <T, R> Source #

Methods

method TryOptionNoneContext<T, R> None (Func<R> noneHandler) Source #

method TryOptionNoneContext<T, R> None (R noneValue) Source #

struct TryOptionSomeUnitContext <T> Source #

Methods

method TryOptionNoneUnitContext<T> None (Action noneHandler) Source #

struct TryOptionNoneContext <T, R> Source #

Methods

method R Fail (Func<Exception, R> failHandler) Source #

method R Fail (R failValue) Source #

struct TryOptionNoneUnitContext <T> Source #

Methods

method Unit Fail (Action<Exception> failHandler) Source #