Skip to content

Commit

Permalink
Implement ValueTask.CompletedTask, it is not available in NetStandard…
Browse files Browse the repository at this point in the history
… 2.1
  • Loading branch information
abelbraaksma committed Nov 14, 2022
1 parent 9e92fe8 commit 600cea5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/FSharp.Control.TaskSeq/Utils.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ namespace FSharp.Control

open System.Threading.Tasks

[<AutoOpen>]
module ValueTaskExtensions =
/// Extensions for ValueTask that are not available in NetStandard 2.1, but are
/// available in .NET 5+.
type ValueTask with

/// (Extension member) Gets a task that has already completed successfully.
static member inline CompletedTask = Unchecked.defaultof<ValueTask>

module Task =
/// Convert an Async<'T> into a Task<'T>
let inline ofAsync (async: Async<'T>) = task { return! async }
Expand Down

0 comments on commit 600cea5

Please sign in to comment.