Skip to content

Commit f308d16

Browse files
committed
Asyncinterfaces (#250)
* use Microsoft.Bcl.AsyncInterfaces * Updated IcedTasks to 0.11.0 * Fix for fable
1 parent 93c3e2a commit f308d16

File tree

27 files changed

+112
-150
lines changed

27 files changed

+112
-150
lines changed

paket.dependencies

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
source https://api.nuget.org/v3/index.json
22

3-
43
storage: none
54
lowest_matching: true
65
strategy: min
76
nuget FSharp.Core >= 6.0.1
87
nuget Hopac >= 0.5.1
98
nuget FSharp.Control.AsyncSeq >= 3.2.1
109
nuget Fable.Core >= 4.2.0
11-
nuget IcedTasks >= 0.10.2
10+
nuget IcedTasks >= 0.11.0
1211
nuget Microsoft.SourceLink.GitHub prerelease copy_local: true
13-
14-
12+
nuget Microsoft.Bcl.AsyncInterfaces >= 6.0.0 framework:netstandard2.0
1513

1614
group Test
1715
source https://api.nuget.org/v3/index.json
@@ -27,6 +25,7 @@ nuget Fable.Core
2725
nuget Fable.Mocha
2826
nuget Fable.Python
2927
nuget Fable.Pyxpecto
28+
nuget Microsoft.Bcl.AsyncInterfaces >= 6.0.0
3029

3130
group Benchmarks
3231
source https://api.nuget.org/v3/index.json

paket.lock

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,18 @@ NUGET
1010
FSharp.Core (6.0.1)
1111
Hopac (0.5.1)
1212
FSharp.Core (>= 4.5.2) - restriction: >= netstandard2.0
13-
IcedTasks (0.10.2)
13+
IcedTasks (0.11)
1414
FSharp.Core (>= 6.0.1) - restriction: >= netstandard2.0
15-
Microsoft.Bcl.AsyncInterfaces (5.0) - restriction: >= netstandard2.0
16-
System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (>= net461) (&& (< netcoreapp2.1) (>= netstandard2.0) (< netstandard2.1))
15+
Microsoft.Bcl.AsyncInterfaces (>= 6.0) - restriction: && (>= netstandard2.0) (< netstandard2.1)
16+
Microsoft.Bcl.AsyncInterfaces (6.0) - restriction: == netstandard2.0
17+
System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (>= net461) (&& (>= netstandard2.0) (< netstandard2.1))
1718
Microsoft.Build.Tasks.Git (8.0) - copy_local: true
1819
Microsoft.SourceLink.Common (8.0) - copy_local: true
1920
Microsoft.SourceLink.GitHub (8.0) - copy_local: true
2021
Microsoft.Build.Tasks.Git (>= 8.0)
2122
Microsoft.SourceLink.Common (>= 8.0)
22-
System.Runtime.CompilerServices.Unsafe (4.5.3) - restriction: || (&& (< monoandroid) (< netstandard1.0) (>= netstandard2.0) (< win8)) (&& (< net45) (< netcoreapp2.1) (>= netstandard2.0) (< netstandard2.1) (< xamarintvos) (< xamarinwatchos)) (&& (>= net461) (>= netstandard2.0)) (&& (< netstandard1.0) (>= netstandard2.0) (>= win8)) (&& (>= netstandard2.0) (>= wp8))
23-
System.Threading.Tasks.Extensions (4.5.4) - restriction: || (&& (>= net461) (>= netstandard2.0)) (&& (< netcoreapp2.1) (>= netstandard2.0) (< netstandard2.1))
23+
System.Runtime.CompilerServices.Unsafe (4.5.3) - restriction: == netstandard2.0
24+
System.Threading.Tasks.Extensions (4.5.4) - restriction: == netstandard2.0
2425
System.Runtime.CompilerServices.Unsafe (>= 4.5.3) - restriction: || (&& (< monoandroid) (< monotouch) (< net45) (>= netstandard1.0) (< netstandard2.0) (< win8) (< wpa81) (< xamarintvos) (< xamarinwatchos)) (&& (< monoandroid) (< netstandard1.0) (>= portable-net45+win8+wp8+wpa81) (< win8)) (&& (>= net45) (< netstandard2.0)) (&& (< net45) (< netcoreapp2.1) (>= netstandard2.0) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (>= net461) (&& (< netstandard1.0) (>= win8)) (&& (< netstandard2.0) (>= wpa81)) (>= wp8)
2526

2627
GROUP Benchmarks
@@ -885,6 +886,8 @@ NUGET
885886
FSharp.Core (7.0.402)
886887
Hopac (0.5.1) - restriction: >= net6.0
887888
FSharp.Core (>= 4.5.2) - restriction: >= netstandard2.0
889+
Microsoft.Bcl.AsyncInterfaces (6.0)
890+
System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (>= net461) (&& (>= netstandard2.0) (< netstandard2.1))
888891
Microsoft.CodeCoverage (17.8) - restriction: || (>= net462) (>= netcoreapp3.1)
889892
Microsoft.NET.Test.Sdk (17.8)
890893
Microsoft.CodeCoverage (>= 17.8) - restriction: || (>= net462) (>= netcoreapp3.1)
@@ -907,7 +910,9 @@ NUGET
907910
System.Reflection.Metadata (8.0) - restriction: >= netcoreapp3.1
908911
System.Collections.Immutable (>= 8.0) - restriction: || (>= net462) (>= netstandard2.0)
909912
System.Memory (>= 4.5.5) - restriction: || (>= net462) (&& (< net6.0) (>= netstandard2.0))
910-
System.Runtime.CompilerServices.Unsafe (6.0) - restriction: || (&& (>= monoandroid) (>= netcoreapp3.1) (< netstandard1.1)) (&& (< monoandroid) (< netcoreapp2.1) (>= netcoreapp3.1)) (&& (< monoandroid) (>= netcoreapp3.1) (< netstandard1.1)) (&& (< monoandroid) (>= netcoreapp3.1) (< netstandard2.0)) (&& (>= monotouch) (>= netcoreapp3.1)) (&& (>= net45) (>= netcoreapp3.1) (< netstandard2.0)) (&& (>= net461) (>= netcoreapp3.1)) (&& (>= net462) (>= net6.0)) (&& (>= net462) (>= netcoreapp3.1)) (&& (>= net6.0) (< net7.0)) (&& (< net6.0) (>= netcoreapp3.1) (>= xamarinios)) (&& (< net6.0) (>= netcoreapp3.1) (>= xamarinmac)) (&& (< net6.0) (>= netcoreapp3.1) (>= xamarintvos)) (&& (< net6.0) (>= netcoreapp3.1) (>= xamarinwatchos)) (&& (< netcoreapp2.0) (>= netcoreapp3.1)) (&& (>= netcoreapp3.1) (< netstandard1.1) (>= win8)) (&& (>= netcoreapp3.1) (< netstandard2.0) (>= wpa81)) (&& (>= netcoreapp3.1) (>= uap10.1))
913+
System.Runtime.CompilerServices.Unsafe (6.0) - restriction: || (&& (>= monoandroid) (>= netcoreapp3.1) (< netstandard1.1)) (&& (< monoandroid) (< netcoreapp2.1) (>= netcoreapp3.1)) (&& (< monoandroid) (>= netcoreapp3.1) (< netstandard1.1)) (&& (< monoandroid) (>= netcoreapp3.1) (< netstandard2.0)) (&& (< monoandroid) (< netstandard1.0) (>= netstandard2.0) (< win8)) (&& (>= monotouch) (>= netcoreapp3.1)) (&& (>= net45) (>= netcoreapp3.1) (< netstandard2.0)) (&& (< net45) (< netcoreapp2.1) (>= netstandard2.0) (< netstandard2.1) (< xamarintvos) (< xamarinwatchos)) (>= net461) (&& (>= net462) (>= net6.0)) (&& (>= net462) (>= netcoreapp3.1)) (&& (>= net6.0) (< net7.0)) (&& (< net6.0) (>= netcoreapp3.1) (>= xamarinios)) (&& (< net6.0) (>= netcoreapp3.1) (>= xamarinmac)) (&& (< net6.0) (>= netcoreapp3.1) (>= xamarintvos)) (&& (< net6.0) (>= netcoreapp3.1) (>= xamarinwatchos)) (&& (< netcoreapp2.0) (>= netcoreapp3.1)) (&& (>= netcoreapp3.1) (< netstandard1.1) (>= win8)) (&& (>= netcoreapp3.1) (< netstandard2.0) (>= wpa81)) (&& (>= netcoreapp3.1) (>= uap10.1)) (&& (< netstandard1.0) (>= netstandard2.0) (>= win8)) (&& (>= netstandard2.0) (>= wp8))
914+
System.Threading.Tasks.Extensions (4.5.4) - restriction: || (>= net461) (&& (>= netstandard2.0) (< netstandard2.1))
915+
System.Runtime.CompilerServices.Unsafe (>= 4.5.3) - restriction: || (&& (< monoandroid) (< monotouch) (< net45) (>= netstandard1.0) (< netstandard2.0) (< win8) (< wpa81) (< xamarintvos) (< xamarinwatchos)) (&& (< monoandroid) (< netstandard1.0) (>= portable-net45+win8+wp8+wpa81) (< win8)) (&& (>= net45) (< netstandard2.0)) (&& (< net45) (< netcoreapp2.1) (>= netstandard2.0) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (>= net461) (&& (< netstandard1.0) (>= win8)) (&& (< netstandard2.0) (>= wpa81)) (>= wp8)
911916
YoloDev.Expecto.TestSdk (0.14.3)
912917
Expecto (>= 10.0 < 11.0) - restriction: >= net6.0
913918
FSharp.Core (>= 7.0.200) - restriction: >= net6.0
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
Microsoft.SourceLink.GitHub
22
FSharp.Core
33
FSharp.Control.AsyncSeq
4+
Microsoft.Bcl.AsyncInterfaces

src/FsToolkit.ErrorHandling.IcedTasks/CancellableTaskResultCE.fs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ module CancellableTaskResultCE =
177177
)
178178
)
179179

180-
#if NETSTANDARD2_1 || NET6_0_OR_GREATER
181180
member inline internal this.TryFinallyAsync
182181
(
183182
body: CancellableTaskResultCode<'TOverall, 'Error, 'T>,
@@ -239,7 +238,7 @@ module CancellableTaskResultCE =
239238
ValueTask()
240239
)
241240
)
242-
#endif
241+
243242
member inline this.Source
244243
(ctr: CancellableTaskResult<'T, 'Error>)
245244
: CancellableTaskResult<'T, 'Error> =
@@ -258,10 +257,9 @@ module CancellableTaskResultCE =
258257
|> Async.map Result.ofChoice
259258
|> this.Source
260259

261-
#if NETSTANDARD2_1 || NET6_0_OR_GREATER
262260
member inline _.Source(t: ValueTask<Result<_, _>>) : CancellableTaskResult<'T, 'Error> =
263261
cancellableTask { return! t }
264-
#endif
262+
265263
member inline _.Source(result: Result<_, _>) : CancellableTaskResult<_, _> =
266264
CancellableTask.singleton result
267265

src/FsToolkit.ErrorHandling.IcedTasks/CancellableTaskValidationCE.fs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ module CancellableTaskValidationCE =
175175
)
176176
)
177177
)
178-
#if NETSTANDARD2_1 || NET6_0_OR_GREATER
178+
179179
member inline internal this.TryFinallyAsync
180180
(
181181
[<InlineIfLambda>] body: CancellableTaskValidationCode<'TOverall, 'Error, 'T>,
@@ -238,7 +238,6 @@ module CancellableTaskValidationCE =
238238
ValueTask()
239239
)
240240
)
241-
#endif
242241

243242
[<NoEagerConstraintApplication>]
244243
static member inline BindDynamic

src/FsToolkit.ErrorHandling.IcedTasks/paket.references

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
Microsoft.SourceLink.GitHub
33
FSharp.Core
44
IcedTasks
5+
Microsoft.Bcl.AsyncInterfaces
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
Microsoft.SourceLink.GitHub
22
FSharp.Core
33
Hopac
4+
Microsoft.Bcl.AsyncInterfaces

src/FsToolkit.ErrorHandling.TaskResult/Task.fs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ module Task =
1515
return! f x
1616
}
1717

18-
#if NETSTANDARD2_1 || NET6_0_OR_GREATER
18+
1919
let inline bindV ([<InlineIfLambda>] f: 'a -> Task<'b>) (x: ValueTask<'a>) =
2020
task {
2121
let! x = x
2222
return! f x
2323
}
24-
#endif
24+
2525
let inline apply f x =
2626
bind (fun f' -> bind (fun x' -> singleton (f' x')) x) f
2727

@@ -32,14 +32,12 @@ module Task =
3232
>> singleton
3333
)
3434

35-
#if NETSTANDARD2_1 || NET6_0_OR_GREATER
3635
let inline mapV ([<InlineIfLambda>] f) x =
3736
x
3837
|> bindV (
3938
f
4039
>> singleton
4140
)
42-
#endif
4341

4442
let inline map2 ([<InlineIfLambda>] f) x y = (apply (apply (singleton f) x) y)
4543

src/FsToolkit.ErrorHandling.TaskResult/TaskOptionCE.fs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ open System
44
open System.Threading.Tasks
55

66

7-
87
open System
98
open System.Runtime.CompilerServices
109
open System.Threading
@@ -153,7 +152,6 @@ type TaskOptionBuilderBase() =
153152
)
154153
)
155154

156-
#if NETSTANDARD2_1 || NET6_0_OR_GREATER
157155
member inline internal this.TryFinallyAsync
158156
(
159157
body: TaskOptionCode<'TOverall, 'T>,
@@ -213,20 +211,16 @@ type TaskOptionBuilderBase() =
213211
ValueTask()
214212
)
215213
)
216-
#endif
217214

218215
member inline this.Source(computation: Async<'T option>) : TaskOption<'T> =
219216
computation
220217
|> Async.StartImmediateAsTask
221218

222219
member inline this.Source(taskOption: TaskOption<'T>) : TaskOption<'T> = taskOption
223220

224-
225-
#if NETSTANDARD2_1 || NET6_0_OR_GREATER
226-
227221
member inline this.Source(taskOption: ValueTask<'T option>) : TaskOption<'T> =
228222
taskOption.AsTask()
229-
#endif
223+
230224

231225
type TaskOptionBuilder() =
232226

@@ -607,7 +601,6 @@ module TaskOptionCEExtensionsMediumPriority =
607601
return Some()
608602
}
609603

610-
#if NETSTANDARD2_1 || NET6_0_OR_GREATER
611604
member inline this.Source(t: ValueTask<'T>) : TaskOption<'T> =
612605
t
613606
|> Task.mapV Some
@@ -617,7 +610,6 @@ module TaskOptionCEExtensionsMediumPriority =
617610
do! t
618611
return Some()
619612
}
620-
#endif
621613

622614
member inline this.Source(opt: Option<'T>) : TaskOption<'T> = Task.FromResult opt
623615

src/FsToolkit.ErrorHandling.TaskResult/TaskResultCE.fs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ open System
44
open System.Threading.Tasks
55

66

7-
87
open System
98
open System.Runtime.CompilerServices
109
open System.Threading
@@ -153,7 +152,6 @@ type TaskResultBuilderBase() =
153152
)
154153
)
155154

156-
#if NETSTANDARD2_1 || NET6_0_OR_GREATER
157155
member inline internal this.TryFinallyAsync
158156
(
159157
body: TaskResultCode<'TOverall, 'Error, 'T>,
@@ -215,7 +213,7 @@ type TaskResultBuilderBase() =
215213
ValueTask()
216214
)
217215
)
218-
#endif
216+
219217

220218
member inline this.Source(taskResult: TaskResult<'T, 'Error>) : TaskResult<'T, 'Error> =
221219
taskResult
@@ -224,9 +222,8 @@ type TaskResultBuilderBase() =
224222
result
225223
|> Async.StartImmediateAsTask
226224

227-
#if NETSTANDARD2_1 || NET6_0_OR_GREATER
228225
member inline _.Source(t: ValueTask<Result<_, _>>) : Task<Result<_, _>> = task { return! t }
229-
#endif
226+
230227
member inline _.Source(result: Result<_, _>) : Task<Result<_, _>> = Task.singleton result
231228

232229
member inline _.Source(result: Choice<_, _>) : Task<Result<_, _>> =

0 commit comments

Comments
 (0)