Logo Orsak

CancellationSource Module

Effects for reading and cancelling the environment's CancellationTokenSource.

Functions and values

Function or value Description

cancel ()

Full Usage: cancel ()

Parameters:
    () : unit

Returns: Effect<'a, unit, 'b>
Type parameters: 'a, 'b (requires :> Orsak.ICancellationProvider)

An effect that cancels the environment's cancellation source.

() : unit
Returns: Effect<'a, unit, 'b>

getToken ()

Full Usage: getToken ()

Parameters:
    () : unit

Returns: Effect<'a, CancellationToken, 'b>
Type parameters: 'a, 'b (requires :> Orsak.ICancellationProvider)

An effect that gets the token of the environment's cancellation source, e.g. to pass on to .NET APIs.

() : unit
Returns: Effect<'a, CancellationToken, 'b>
Example

 let download (client: HttpClient) (url: string) = eff {
     let! token = CancellationSource.getToken ()
     return! client.GetStringAsync(url, token)
 }
val download: client: 'a -> url: string -> 'b
val client: 'a
val url: string
Multiple items
val string: value: 'T -> string

--------------------
type string = System.String

Type something to start searching.