Yaaf.FSharp.Helper


AsyncExtensions

Defined in Yaaf.FSharp.Helper.dll.

Type extensions

Type extensionDescription
AwaitTask(task, ?cancellationToken)
Signature: (task:Task * cancellationToken:CancellationToken option) -> Async<unit>

Starts a non-generic Task with the cancellationToken and returns an Async containing the result.

Bind(t, f)
Signature: (t:Task<'T> * f:('T -> Async<'R>)) -> Async<'R>
Type parameters: 'T, 'R
Bind(t, f)
Signature: (t:Task * f:(unit -> Async<'R>)) -> Async<'R>
Type parameters: 'R
Cache(input)
Signature: input:Async<'T> -> Async<'T>
Type parameters: 'T

Creates an asynchronous workflow that runs the asynchronous workflow given as an argument at most once. When the returned workflow is started for the second time, it reuses the result of the previous execution.

StartDisposable(op)
Signature: op:Async<unit> -> IDisposable

Starts the specified operation using a new CancellationToken and returns IDisposable object that cancels the computation. This method can be used when implementing the Subscribe method of IObservable interface.

TryAwaitTask(...)
Signature: (task:Task<'?22629> * timeout:int option * cancellationToken:CancellationToken option) -> Async<'?22629 option>
Type parameters: '?22629

Starts a Task<'a> with the timeout and cancellationToken and returns a Async containing the result. If the Task does not complete in the timeout interval, or is faulted None is returned.

Fork me on GitHub