From 600cea593a64e752f90b3a402ecc2d9f475b46df Mon Sep 17 00:00:00 2001 From: Abel Braaksma Date: Wed, 9 Nov 2022 23:11:10 +0100 Subject: [PATCH] Implement ValueTask.CompletedTask, it is not available in NetStandard 2.1 --- src/FSharp.Control.TaskSeq/Utils.fs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/FSharp.Control.TaskSeq/Utils.fs b/src/FSharp.Control.TaskSeq/Utils.fs index ecc2f685..74bd115a 100644 --- a/src/FSharp.Control.TaskSeq/Utils.fs +++ b/src/FSharp.Control.TaskSeq/Utils.fs @@ -2,6 +2,15 @@ namespace FSharp.Control open System.Threading.Tasks +[] +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 + module Task = /// Convert an Async<'T> into a Task<'T> let inline ofAsync (async: Async<'T>) = task { return! async }