apply

Namespace: FsToolkit.ErrorHandling

Function Signature:

CancellableValueTask<('a -> 'b) option> -> CancellableValueTask<'a option> -> CancellableValueTask<'b option>

Examples

Take the following function for example

// string -> int
let characterCount (s: string) = s.Length

Example 1

let result =
    CancellableValueTaskOption.some "foo" // CancellableValueTask<string option>
    |> CancellableValueTaskOption.apply (CancellableValueTaskOption.some characterCount) // CancellableValueTask<int option>

// cancellableValueTask { Some 3 }

Example 2

let result =
    CancellableValueTask.singleton None // CancellableValueTask<string option>
    |> CancellableValueTaskOption.apply (CancellableValueTaskOption.some characterCount) // CancellableValueTask<int option>

// cancellableValueTask { None }

Example 3

Last updated