LanguageExt.Core

LanguageExt.Core DataTypes Cond

Contents

delegate Cond <A, B> Source #

Conditional computation. Represents a computation that could succeed or fail. The result of the computation is an Option data-type.

Parameters

type A

Input type to the conditional computation

type B

Resulting value type on success

param input

Input value

returns

Optional result

class Prelude Source #

Methods

method Cond<A, A> Cond <A> (Func<A, bool> pred) Source #

Conditional computation constructor. Represents a computation that could succeed or fail. The result of the computation is an Option data-type. Use the fluent API methods of Then and Else to extract the monadic value.

Parameters

type A

Input type to the conditional computation

param pred

Predicate to apply to the input value

returns

Conditional computation

method Cond<A, A> Subj <A> () Source #

Conditional computation constructor. Represents a computation that could succeed or fail. The result of the computation is an Option data-type. Use the fluent API methods of Then and Else to extract the monadic value.

Parameters

type A

Input type to the conditional computation

param pred

Predicate to apply to the input value

returns

Conditional computation

class CondExt Source #

Extensions to the Cond type

Methods

method B Apply <A, B> (this A a, Func<A, B> f) Source #

Apply a value as the first argument to the function provided.

This is a general case apply function, however it is especially useful for fluently applying a value to the result of the Cond.Else() extension method.

Parameters

type A

Type of the value to apply to the function

type B

Type of the value that results from this computation

param a

Value to apply to the function

param f

Function to apply the value to

returns

The result of applying the value to the function

method Cond<A, B> Then <A, B> (this Cond<A, A> self, Func<A, B> f) Source #

Provide the behaviour to run if the condition of the Cond computation is in a Some/True state. This is equivalent to the 'then' part of an If/Then/Else operation.

Parameters

type A

Type of the value that is input to the computation

type B

Type of the value that results from this computation

param self

The Cond computation to compose with

param f

The 'then' computation

returns

A conditional computation

method Cond<A, B> Then <A, B> (this Cond<A, A> self, Func<B> f) Source #

Provide the behaviour to run if the condition of the Cond computation is in a Some/True state. This is equivalent to the 'then' part of an If/Then/Else operation.

Parameters

type A

Type of the value that is input to the computation

type B

Type of the value that results from this computation

param self

The Cond computation to compose with

param f

The 'then' computation

returns

A conditional computation

method Cond<A, B> Then <A, B> (this Cond<A, A> self, B value) Source #

Provide the behaviour to run if the condition of the Cond computation is in a Some/True state. This is equivalent to the 'then' part of an If/Then/Else operation.

Parameters

type A

Type of the value that is input to the computation

type B

Type of the value that results from this computation

param self

The Cond computation to compose with

param value

The 'then' value

returns

A conditional computation

method Cond<A, B> Any <A, B> (this Cond<A, B> self, params Func<B, bool>[] predicates) Source #

A conditional computation where the input value can match any of the predicates provided to return a positive Some/True state. This is like an if(a || b || c ...) operation.

Parameters

type A

Type of the value that is input to the computation

type B

Type of the value that results from this computation

param self

The Cond computation to test

param predicates

The predicates to test the bound value with

returns

A conditional computation

method Cond<A, B> All <A, B> (this Cond<A, B> self, params Func<B, bool>[] predicates) Source #

A conditional computation where the input value must match all of the predicates provided to return a positive Some/True state. This is like an if(a && b && c ...) operation.

Parameters

type A

Type of the value that is input to the computation

type B

Type of the value that results from this computation

param self

The Cond computation to test

param predicates

The predicates to test the bound value with

returns

A conditional computation

method Func<A, B> Else <A, B> (this Cond<A, B> self, Func<A, B> f) Source #

Builds a delegate that runs the conditional computation, taking an input value and returning a result value. This would usually be the last thing in a fluent Cond computation.

Parameters

type A

Type of the input value

type B

Type of the result value

param self

The Cond computation to test

param f

The Else function to run if the Cond computation ends up in a None/False state.

returns

The result of the conditional computation

method Func<A, B> Else <A, B> (this Cond<A, B> self, Func<B> f) Source #

Builds a delegate that runs the conditional computation, taking an input value and returning a result value. This would usually be the last thing in a fluent Cond computation.

Parameters

type A

Type of the input value

type B

Type of the result value

param self

The Cond computation to test

param f

The else function to run if the Cond computation ends up in a None/False state.

returns

The result of the conditional computation

method Func<A, B> Else <A, B> (this Cond<A, B> self, B value) Source #

Builds a delegate that runs the conditional computation, taking an input value and returning a result value. This would usually be the last thing in a fluent Cond computation.

Parameters

type A

Type of the input value

type B

Type of the result value

param self

The Cond computation to test

param value

The else value to use if the Cond computation ends up in a None/False state.

returns

The result of the conditional computation

method Func<Task<A>, Task<B>> ElseAsync <A, B> (this Cond<A, B> self, Func<A, B> f) Source #

Builds a delegate that runs the conditional computation, taking an input value and returning a result value. This would usually be the last thing in a fluent Cond computation.

Parameters

type A

Type of the input value

type B

Type of the result value

param self

The Cond computation to test

param f

The Else function to run if the Cond computation ends up in a None/False state.

returns

The result of the conditional computation

method Func<Task<A>, Task<B>> ElseAsync <A, B> (this Cond<A, B> self, Func<B> f) Source #

Builds a delegate that runs the conditional computation, taking an input value and returning a result value. This would usually be the last thing in a fluent Cond computation.

Parameters

type A

Type of the input value

type B

Type of the result value

param self

The Cond computation to test

param f

The else function to run if the Cond computation ends up in a None/False state.

returns

The result of the conditional computation

method Func<Task<A>, Task<B>> ElseAsync <A, B> (this Cond<A, B> self, B value) Source #

Builds a delegate that runs the conditional computation, taking an input value and returning a result value. This would usually be the last thing in a fluent Cond computation.

Parameters

type A

Type of the input value

type B

Type of the result value

param self

The Cond computation to test

param value

The else value to use if the Cond computation ends up in a None/False state.

returns

The result of the conditional computation

method Cond<A, C> Map <A, B, C> (this Cond<A, B> self, Func<B, C> map) Source #

Functor map of the conditional computation

Parameters

type A

Source computation input type

type B

Source computation output type

type C

Mapped computation output type

param self

The conditional computation to map

param map

Functor mapping function

returns

A mapped conditional computation

method Cond<A, C> Select <A, B, C> (this Cond<A, B> self, Func<B, C> map) Source #

Functor map of the conditional computation

Parameters

type A

Source computation input type

type B

Source computation output type

type C

Mapped computation output type

param self

The conditional computation to map

param map

Functor mapping function

returns

A mapped conditional computation

method Cond<A, D> SelectMany <A, B, C, D> ( this Cond<A, B> self, Func<B, Cond<A, C>> bind, Func<B, C, D> project) Source #

Monadic bind for conditional computations. Allows nesting of computations that follow the rules of Cond, namely that a None/False result cancels the operation until an Else is encountered.

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

Filter the conditional computation. This is the equivalent of the predicate in an If statement.

Parameters

type A

The input type of the conditional computation

type B

The output type of the conditional computation

param self

The conditional computation to test

param pred

The predicate function

returns

A conditional computation

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

Filter the conditional computation. This is the equivalent of the predicate in an If statement.

Parameters

type A

The input type of the conditional computation

type B

The output type of the conditional computation

param self

The conditional computation to test

param pred

The predicate function

returns

A conditional computation

delegate CondAsync <A, B> Source #

Conditional asynchronous computation. Represents a computation that could succeed or fail. The result of the computation is an Option data-type promise.

Parameters

type A

Input type to the conditional computation

type B

Resulting value type on success

param input

Input value type

returns

Promise to return an optional result

class Prelude Source #

Methods

method CondAsync<A, A> Cond <A> (Func<A, Task<bool>> pred) Source #

Conditional asynchronous computation constructor. Represents a computation that could succeed or fail. The result of the computation is an Option data-type. Use the fluent API methods of Then and Else to extract the monadic value.

Parameters

type A

Input type to the conditional computation

param pred

Predicate to apply to the input value

returns

Conditional computation

class CondAsyncExt Source #

Extensions to the CondAsync type

Methods

method CondAsync<A, B> Then <A, B> (this CondAsync<A, A> self, Func<A, B> f) Source #

Provide the behaviour to run if the condition of the Cond computation is in a Some/True state. This is equivalent to the 'then' part of an If/Then/Else operation.

Parameters

type A

Type of the value that is input to the computation

type B

Type of the value that results from this computation

param self

The Cond computation to compose with

param f

The 'then' computation

returns

A conditional computation

method CondAsync<A, B> Then <A, B> (this CondAsync<A, A> self, Func<B> f) Source #

Provide the behaviour to run if the condition of the Cond computation is in a Some/True state. This is equivalent to the 'then' part of an If/Then/Else operation.

Parameters

type A

Type of the value that is input to the computation

type B

Type of the value that results from this computation

param self

The Cond computation to compose with

param f

The 'then' computation

returns

A conditional computation

method CondAsync<A, B> Then <A, B> (this CondAsync<A, A> self, B value) Source #

Provide the behaviour to run if the condition of the Cond computation is in a Some/True state. This is equivalent to the 'then' part of an If/Then/Else operation.

Parameters

type A

Type of the value that is input to the computation

type B

Type of the value that results from this computation

param self

The Cond computation to compose with

param value

The 'then' value

returns

A conditional computation

method CondAsync<A, B> Then <A, B> (this CondAsync<A, A> self, Func<A, Task<B>> f) Source #

Provide the behaviour to run if the condition of the Cond computation is in a Some/True state. This is equivalent to the 'then' part of an If/Then/Else operation.

Parameters

type A

Type of the value that is input to the computation

type B

Type of the value that results from this computation

param self

The Cond computation to compose with

param f

The 'then' computation

returns

A conditional computation

method CondAsync<A, B> Then <A, B> (this CondAsync<A, A> self, Func<Task<B>> f) Source #

Provide the behaviour to run if the condition of the Cond computation is in a Some/True state. This is equivalent to the 'then' part of an If/Then/Else operation.

Parameters

type A

Type of the value that is input to the computation

type B

Type of the value that results from this computation

param self

The Cond computation to compose with

param f

The 'then' computation

returns

A conditional computation

method CondAsync<A, B> Then <A, B> (this CondAsync<A, A> self, Task<B> value) Source #

Provide the behaviour to run if the condition of the Cond computation is in a Some/True state. This is equivalent to the 'then' part of an If/Then/Else operation.

The Then task will always run, even if not needed by the computation. Only use this variant if the Then task is a Task.FromResult(x) or you absolutely definitely need the operation to run in parallel to the If/Else computation so that the result is available as quickly as possible.

Parameters

type A

Type of the value that is input to the computation

type B

Type of the value that results from this computation

param self

The Cond computation to compose with

param value

The 'then' value

returns

A conditional computation

method CondAsync<A, B> Any <A, B> (this CondAsync<A, B> self, params Func<B, Task<bool>>[] predicates) Source #

A conditional computation where the input value can match any of the predicates provided to return a positive Some/True state. This is like an if(a || b || c ...) operation.

Parameters

type A

Type of the value that is input to the computation

type B

Type of the value that results from this computation

param self

The Cond computation to test

param predicates

The predicates to test the bound value with

returns

A conditional computation

method CondAsync<A, B> All <A, B> (this CondAsync<A, B> self, params Func<B, Task<bool>>[] predicates) Source #

A conditional computation where the input value must match all of the predicates provided to return a positive Some/True state. This is like an if(a && b && c ...) operation.

Parameters

type A

Type of the value that is input to the computation

type B

Type of the value that results from this computation

param self

The Cond computation to test

param predicates

The predicates to test the bound value with

returns

A conditional computation

method CondAsync<A, B> Any <A, B> (this CondAsync<A, B> self, params Func<B, bool>[] predicates) Source #

A conditional computation where the input value can match any of the predicates provided to return a positive Some/True state. This is like an if(a || b || c ...) operation.

Parameters

type A

Type of the value that is input to the computation

type B

Type of the value that results from this computation

param self

The Cond computation to test

param predicates

The predicates to test the bound value with

returns

A conditional computation

method CondAsync<A, B> All <A, B> (this CondAsync<A, B> self, params Func<B, bool>[] predicates) Source #

A conditional computation where the input value must match all of the predicates provided to return a positive Some/True state. This is like an if(a && b && c ...) operation.

Parameters

type A

Type of the value that is input to the computation

type B

Type of the value that results from this computation

param self

The Cond computation to test

param predicates

The predicates to test the bound value with

returns

A conditional computation

method Func<A, Task<B>> Else <A, B> (this CondAsync<A, B> self, Func<A, B> f) Source #

Builds a delegate that runs the conditional computation, taking an input value and returning a result value. This would usually be the last thing in a fluent Cond computation.

Parameters

type A

Type of the input value

type B

Type of the result value

param self

The Cond computation to test

param f

The else function to run if the Cond computation ends up in a None/False state.

returns

The result of the conditional computation

method Func<A, Task<B>> Else <A, B> (this CondAsync<A, B> self, Func<B> f) Source #

Builds a delegate that runs the conditional computation, taking an input value and returning a result value. This would usually be the last thing in a fluent Cond computation.

Parameters

type A

Type of the input value

type B

Type of the result value

param self

The Cond computation to test

param f

The else function to run if the Cond computation ends up in a None/False state.

returns

The result of the conditional computation

method Func<A, Task<B>> Else <A, B> (this CondAsync<A, B> self, B value) Source #

Builds a delegate that runs the conditional computation, taking an input value and returning a result value. This would usually be the last thing in a fluent Cond computation.

Parameters

type A

Type of the input value

type B

Type of the result value

param self

The Cond computation to test

param value

The else value to use if the Cond computation ends up in a None/False state.

returns

The result of the conditional computation

method Func<A, Task<B>> Else <A, B> (this CondAsync<A, B> self, Func<A, Task<B>> f) Source #

Builds a delegate that runs the conditional computation, taking an input value and returning a result value. This would usually be the last thing in a fluent Cond computation.

Parameters

type A

Type of the input value

type B

Type of the result value

param self

The Cond computation to test

param f

The else function to run if the Cond computation ends up in a None/False state.

returns

The result of the conditional computation

method Func<A, Task<B>> Else <A, B> (this CondAsync<A, B> self, Func<Task<B>> f) Source #

Builds a delegate that runs the conditional computation, taking an input value and returning a result value. This would usually be the last thing in a fluent Cond computation.

Parameters

type A

Type of the input value

type B

Type of the result value

param self

The Cond computation to test

param f

The else function to run if the Cond computation ends up in a None/False state.

returns

The result of the conditional computation

method Func<A, Task<B>> Else <A, B> (this CondAsync<A, B> self, Task<B> valuePromise) Source #

Builds a delegate that runs the conditional computation, taking an input value and returning a result value. This would usually be the last thing in a fluent Cond computation.

The Else task will always run, even if not needed by the computation. Only use this variant if the Else task is a Task.FromResult(x) or you absolutely definitely need the operation to run in parallel to the If/Then computation so that the result is available as quickly as possible.

Parameters

type A

Type of the input value

type B

Type of the result value

param self

The Cond computation to test

param valuePromise

The else value promise to use if the Cond computation ends up in a None/False state.

returns

The result of the conditional computation

method Func<Task<A>, Task<B>> ElseAsync <A, B> (this CondAsync<A, B> self, Func<A, B> f) Source #

Builds a delegate that runs the conditional computation, taking an input value and returning a result value. This would usually be the last thing in a fluent Cond computation.

Parameters

type A

Type of the input value

type B

Type of the result value

param self

The Cond computation to test

param f

The else function to run if the Cond computation ends up in a None/False state.

returns

The result of the conditional computation

method Func<Task<A>, Task<B>> ElseAsync <A, B> (this CondAsync<A, B> self, Func<B> f) Source #

Builds a delegate that runs the conditional computation, taking an input value and returning a result value. This would usually be the last thing in a fluent Cond computation.

Parameters

type A

Type of the input value

type B

Type of the result value

param self

The Cond computation to test

param f

The else function to run if the Cond computation ends up in a None/False state.

returns

The result of the conditional computation

method Func<Task<A>, Task<B>> ElseAsync <A, B> (this CondAsync<A, B> self, B value) Source #

Builds a delegate that runs the conditional computation, taking an input value and returning a result value. This would usually be the last thing in a fluent Cond computation.

Parameters

type A

Type of the input value

type B

Type of the result value

param self

The Cond computation to test

param value

The else value to use if the Cond computation ends up in a None/False state.

returns

The result of the conditional computation

method Func<Task<A>, Task<B>> ElseAsync <A, B> (this CondAsync<A, B> self, Func<A, Task<B>> f) Source #

Builds a delegate that runs the conditional computation, taking an input value and returning a result value. This would usually be the last thing in a fluent Cond computation.

Parameters

type A

Type of the input value

type B

Type of the result value

param self

The Cond computation to test

param f

The else function to run if the Cond computation ends up in a None/False state.

returns

The result of the conditional computation

method Func<Task<A>, Task<B>> ElseAsync <A, B> (this CondAsync<A, B> self, Func<Task<B>> f) Source #

Builds a delegate that runs the conditional computation, taking an input value and returning a result value. This would usually be the last thing in a fluent Cond computation.

Parameters

type A

Type of the input value

type B

Type of the result value

param self

The Cond computation to test

param f

The else function to run if the Cond computation ends up in a None/False state.

returns

The result of the conditional computation

method Func<Task<A>, Task<B>> ElseAsync <A, B> (this CondAsync<A, B> self, Task<B> valuePromise) Source #

Builds a delegate that runs the conditional computation, taking an input value and returning a result value. This would usually be the last thing in a fluent Cond computation.

The Else task will always run, even if not needed by the computation. Only use this variant if the Else task is a Task.FromResult(x) or you absolutely definitely need the operation to run in parallel to the If/Then computation so that the result is available as quickly as possible.

Parameters

type A

Type of the input value

type B

Type of the result value

param self

The Cond computation to test

param valuePromise

The else value promise to use if the Cond computation ends up in a None/False state.

returns

The result of the conditional computation

method CondAsync<A, C> Map <A, B, C> (this CondAsync<A, B> self, Func<B, Task<C>> map) Source #

Functor map of the conditional computation

Parameters

type A

Source computation input type

type B

Source computation output type

type C

Mapped computation output type

param self

The conditional computation to map

param map

Functor mapping function

returns

A mapped conditional computation

method CondAsync<A, C> Map <A, B, C> (this CondAsync<A, B> self, Func<B, C> map) Source #

Functor map of the conditional computation

Parameters

type A

Source computation input type

type B

Source computation output type

type C

Mapped computation output type

param self

The conditional computation to map

param map

Functor mapping function

returns

A mapped conditional computation

method CondAsync<A, C> Select <A, B, C> (this CondAsync<A, B> self, Func<B, Task<C>> map) Source #

Functor map of the conditional computation

Parameters

type A

Source computation input type

type B

Source computation output type

type C

Mapped computation output type

param self

The conditional computation to map

param map

Functor mapping function

returns

A mapped conditional computation

method CondAsync<A, C> Select <A, B, C> (this CondAsync<A, B> self, Func<B, C> map) Source #

Functor map of the conditional computation

Parameters

type A

Source computation input type

type B

Source computation output type

type C

Mapped computation output type

param self

The conditional computation to map

param map

Functor mapping function

returns

A mapped conditional computation

method CondAsync<A, D> SelectMany <A, B, C, D> ( this CondAsync<A, B> self, Func<B, CondAsync<A, C>> bind, Func<B, C, D> project) Source #

Monadic bind for conditional computations. Allows nesting of computations that follow the rules of Cond, namely that a None/False result cancels the operation until an Else is encountered.

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

Filter the conditional computation. This is the equivalent of the predicate in an If statement.

Parameters

type A

The input type of the conditional computation

type B

The output type of the conditional computation

param self

The conditional computation to test

param pred

The predicate function

returns

A conditional computation

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

Filter the conditional computation. This is the equivalent of the predicate in an If statement.

Parameters

type A

The input type of the conditional computation

type B

The output type of the conditional computation

param self

The conditional computation to test

param pred

The predicate function

returns

A conditional computation

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

Filter the conditional computation. This is the equivalent of the predicate in an If statement.

Parameters

type A

The input type of the conditional computation

type B

The output type of the conditional computation

param self

The conditional computation to test

param pred

The predicate function

returns

A conditional computation

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

Filter the conditional computation. This is the equivalent of the predicate in an If statement.

Parameters

type A

The input type of the conditional computation

type B

The output type of the conditional computation

param self

The conditional computation to test

param pred

The predicate function

returns

A conditional computation

class CondSyncToAsyncExt Source #

Methods

method CondAsync<A, B> ToAsync <A, B> (this Cond<A, B> self) Source #

Converts a synchronous conditional computation to an asynchronous one

Parameters

type A

Type of the computation input value

type B

Type of the computation output value

param self

The synchronous computation to convert

returns

method CondAsync<A, B> Then <A, B> (this Cond<A, A> self, Func<A, Task<B>> f) Source #

Provide the behaviour to run if the condition of the Cond computation is in a Some/True state. This is equivalent to the 'then' part of an If/Then/Else operation.

Parameters

type A

Type of the value that is input to the computation

type B

Type of the value that results from this computation

param self

The Cond computation to compose with

param f

The 'then' computation

returns

A conditional computation

method CondAsync<A, B> Then <A, B> (this Cond<A, A> self, Func<Task<B>> f) Source #

Provide the behaviour to run if the condition of the Cond computation is in a Some/True state. This is equivalent to the 'then' part of an If/Then/Else operation.

Parameters

type A

Type of the value that is input to the computation

type B

Type of the value that results from this computation

param self

The Cond computation to compose with

param f

The 'then' computation

returns

A conditional computation

method CondAsync<A, B> Then <A, B> (this Cond<A, A> self, Task<B> value) Source #

Provide the behaviour to run if the condition of the Cond computation is in a Some/True state. This is equivalent to the 'then' part of an If/Then/Else operation.

Parameters

type A

Type of the value that is input to the computation

type B

Type of the value that results from this computation

param self

The Cond computation to compose with

param value

The 'then' value

returns

A conditional computation

method CondAsync<A, B> Any <A, B> (this Cond<A, B> self, params Func<B, Task<bool>>[] predicates) Source #

A conditional computation where the input value can match any of the predicates provided to return a positive Some/True state. This is like an if(a || b || c ...) operation.

Parameters

type A

Type of the value that is input to the computation

type B

Type of the value that results from this computation

param self

The Cond computation to test

param predicates

The predicates to test the bound value with

returns

A conditional computation

method CondAsync<A, B> All <A, B> (this Cond<A, B> self, params Func<B, Task<bool>>[] predicates) Source #

A conditional computation where the input value must match all of the predicates provided to return a positive Some/True state. This is like an if(a && b && c ...) operation.

Parameters

type A

Type of the value that is input to the computation

type B

Type of the value that results from this computation

param self

The Cond computation to test

param predicates

The predicates to test the bound value with

returns

A conditional computation

method Func<A, Task<B>> Else <A, B> (this Cond<A, B> self, Func<A, Task<B>> Else) Source #

Builds a delegate that runs the conditional computation, taking an input value and returning a result value. This would usually be the last thing in a fluent Cond computation.

Parameters

type A

Type of the input value

type B

Type of the result value

param self

The Cond computation to test

param Else

The Else function to run if the Cond computation ends up in a None/False state.

returns

The result of the conditional computation

method Func<A, Task<B>> Else <A, B> (this Cond<A, B> self, Func<Task<B>> Else) Source #

Builds a delegate that runs the conditional computation, taking an input value and returning a result value. This would usually be the last thing in a fluent Cond computation.

Parameters

type A

Type of the input value

type B

Type of the result value

param self

The Cond computation to test

param Else

The Else function to run if the Cond computation ends up in a None/False state.

returns

The result of the conditional computation

method Func<A, Task<B>> Else <A, B> (this Cond<A, B> self, Task<B> Else) Source #

Builds a delegate that runs the conditional computation, taking an input value and returning a result value. This would usually be the last thing in a fluent Cond computation.

The Else task will always run, even if not needed by the computation. Only use this variant if the Else task is a Task.FromResult(x) or you absolutely definitely need the operation to run in parallel to the If/Then computation so that the result is available as quickly as possible.

Parameters

type A

Type of the input value

type B

Type of the result value

param self

The Cond computation to test

param Else

The Else task to use if the Cond computation ends up in a None/False state.

returns

The result of the conditional computation

method Func<Task<A>, Task<B>> ElseAsync <A, B> (this Cond<A, B> self, Func<A, Task<B>> Else) Source #

Builds a delegate that runs the conditional computation, taking an input value and returning a result value. This would usually be the last thing in a fluent Cond computation.

Parameters

type A

Type of the input value

type B

Type of the result value

param self

The Cond computation to test

param Else

The Else function to run if the Cond computation ends up in a None/False state.

returns

The result of the conditional computation

method Func<Task<A>, Task<B>> ElseAsync <A, B> (this Cond<A, B> self, Func<Task<B>> Else) Source #

Builds a delegate that runs the conditional computation, taking an input value and returning a result value. This would usually be the last thing in a fluent Cond computation.

Parameters

type A

Type of the input value

type B

Type of the result value

param self

The Cond computation to test

param Else

The Else function to run if the Cond computation ends up in a None/False state.

returns

The result of the conditional computation

method Func<Task<A>, Task<B>> ElseAsync <A, B> (this Cond<A, B> self, Task<B> Else) Source #

Builds a delegate that runs the conditional computation, taking an input value and returning a result value. This would usually be the last thing in a fluent Cond computation.

The Else task will always run, even if not needed by the computation. Only use this variant if the Else task is a Task.FromResult(x) or you absolutely definitely need the operation to run in parallel to the If/Then computation so that the result is available as quickly as possible.

Parameters

type A

Type of the input value

type B

Type of the result value

param self

The Cond computation to test

param Else

The Else task to use if the Cond computation ends up in a None/False state.

returns

The result of the conditional computation

method CondAsync<A, C> Map <A, B, C> (this Cond<A, B> self, Func<B, Task<C>> map) Source #

Functor map of the conditional computation

Parameters

type A

Source computation input type

type B

Source computation output type

type C

Mapped computation output type

param self

The conditional computation to map

param map

Functor mapping function

returns

A mapped conditional computation

method CondAsync<A, C> Select <A, B, C> (this Cond<A, B> self, Func<B, Task<C>> map) Source #

Functor map of the conditional computation

Parameters

type A

Source computation input type

type B

Source computation output type

type C

Mapped computation output type

param self

The conditional computation to map

param map

Functor mapping function

returns

A mapped conditional computation

method CondAsync<A, D> SelectMany <A, B, C, D> ( this Cond<A, B> self, Func<B, CondAsync<A, C>> bind, Func<B, C, D> project) Source #

Monadic bind for conditional computations. Allows nesting of computations that follow the rules of Cond, namely that a None/False result cancels the operation until an Else is encountered.

method CondAsync<A, B> Filter <A, B> (this Cond<A, B> self, Func<B, Task<bool>> pred) Source #

Filter the conditional computation. This is the equivalent of the predicate in an If statement.

Parameters

type A

The input type of the conditional computation

type B

The output type of the conditional computation

param self

The conditional computation to test

param pred

The predicate function

returns

A conditional computation

method CondAsync<A, B> Where <A, B> (this Cond<A, B> self, Func<B, Task<bool>> pred) Source #

Filter the conditional computation. This is the equivalent of the predicate in an If statement.

Parameters

type A

The input type of the conditional computation

type B

The output type of the conditional computation

param self

The conditional computation to test

param pred

The predicate function

returns

A conditional computation