Skip to content

Commit c1ac471

Browse files
committed
Cleanup CompletedTask
1 parent 7222429 commit c1ac471

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

src/FSharp.Control.TaskSeq/Utils.fs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
namespace FSharp.Control
22

3-
open System.Threading.Tasks
43
open System
4+
open System.Threading.Tasks
55

66
[<AutoOpen>]
77
module ValueTaskExtensions =
8-
/// Extensions for ValueTask that are not available in NetStandard 2.1, but are
9-
/// available in .NET 5+. We put them in Extension space to mimic the behavior of NetStandard 2.1
108
type ValueTask with
11-
12-
/// (Extension member) Gets a task that has already completed successfully.
139
static member inline CompletedTask =
14-
// This mimics how it is done in .NET itself
10+
// This mimics how it is done in net5.0 and later internally
1511
Unchecked.defaultof<ValueTask>
1612

17-
1813
module ValueTask =
1914
let False = ValueTask<bool>()
2015
let True = ValueTask<bool> true
@@ -38,7 +33,6 @@ module ValueTask =
3833
[<Obsolete "From version 0.4.0 onward, 'ValueTask.ofIValueTaskSource' is deprecated in favor of 'ValueTask.ofSource'. It will be removed in an upcoming release.">]
3934
let inline ofIValueTaskSource taskSource version = ofSource taskSource version
4035

41-
4236
module Task =
4337
let inline fromResult (value: 'U) : Task<'U> = Task.FromResult value
4438
let inline ofAsync (async: Async<'T>) = task { return! async }

src/FSharp.Control.TaskSeq/Utils.fsi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ open System.Threading.Tasks.Sources
66

77
[<AutoOpen>]
88
module ValueTaskExtensions =
9+
10+
/// Shims back-filling .NET 5+ functionality for use on netstandard2.1
911
type ValueTask with
1012

11-
/// (Extension member) Gets a task that has already completed successfully.
13+
/// (Extension member) Gets a ValueTask that has already completed successfully.
1214
static member inline CompletedTask: ValueTask
1315

1416
module ValueTask =

0 commit comments

Comments
 (0)