You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Remove altcover
It can't cover inline code which this library is all inline code
* Add IAsyncEnumerable to TaskBaseBuilders
* Add IAsyncEnumerable to CancellableTaskBaseBuilders
* AsyncEx IAsyncEnumerable support
* Docs
Copy file name to clipboardExpand all lines: README.md
+18Lines changed: 18 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -119,6 +119,24 @@ AsyncEx is similar to Async except in the following ways:
119
119
}
120
120
```
121
121
122
+
4. Use [IAsyncEnumerable](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.iasyncenumerable-1?view=net-8.0) with `for` keyword. This example uses [TaskSeq](https://github.com/fsprojects/FSharp.Control.TaskSeq) but you can use any `IAsyncEnumerable<T>`.
123
+
124
+
125
+
```fsharp
126
+
open IcedTasks
127
+
open FSharp.Control
128
+
let myAsyncEx = asyncEx {
129
+
let items = taskSeq { // IAsyncEnumerable<T>
130
+
yield 42
131
+
do! Task.Delay(100)
132
+
yield 1701
133
+
}
134
+
let mutable sum = 0
135
+
for i in items do
136
+
sum <- sum + i
137
+
return sum
138
+
}
139
+
```
122
140
123
141
### For [ValueTasks](https://devblogs.microsoft.com/dotnet/understanding-the-whys-whats-and-whens-of-valuetask/)
Copy file name to clipboardExpand all lines: docsSrc/index.md
+19Lines changed: 19 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,6 +90,24 @@ AsyncEx is similar to Async except in the following ways:
90
90
}
91
91
```
92
92
93
+
4. Use [IAsyncEnumerable](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.iasyncenumerable-1?view=net-8.0) with `for` keyword. This example uses [TaskSeq](https://github.com/fsprojects/FSharp.Control.TaskSeq) but you can use any `IAsyncEnumerable<T>`.
94
+
95
+
96
+
```fsharp
97
+
open IcedTasks
98
+
open FSharp.Control
99
+
let myAsyncEx = asyncEx {
100
+
let items = taskSeq { // IAsyncEnumerable<T>
101
+
yield 42
102
+
do! Task.Delay(100)
103
+
yield 1701
104
+
}
105
+
let mutable sum = 0
106
+
for i in items do
107
+
sum <- sum + i
108
+
return sum
109
+
}
110
+
```
93
111
94
112
### For [ValueTasks](https://devblogs.microsoft.com/dotnet/understanding-the-whys-whats-and-whens-of-valuetask/)
95
113
@@ -110,6 +128,7 @@ let myValueTask = task {
110
128
- You want to be able to re-run these executable tasks
111
129
- You don't want to pollute your methods/functions with extra CancellationToken parameters
112
130
- You want the computation to handle checking cancellation before every bind.
131
+
- You want to use the `for` keyword with `IAsyncEnumerable<T>`.
/// <item><description>Allows <c>use</c> on <see cref="T:System.IAsyncDisposable">System.IAsyncDisposable</see></description></item>
362
399
/// <item><description>Allows <c>let!</c> for Tasks, ValueTasks, and any Awaitable Type</description></item>
363
400
/// <item><description>When Tasks throw exceptions they will use the behavior described in <see href="https://github.com/fsharp/fslang-suggestions/issues/840">Async.Await overload (esp. AwaitTask without throwing AggregateException)</see></description></item>
401
+
/// <item><description>Allow <c>for</c> on <see cref="T:System.Collections.Generic.IAsyncEnumerable`1">System.Collections.Generic.IAsyncDisposable</see></description></item>
/// <item><description>Allows <c>use</c> on <see cref="T:System.IAsyncDisposable">System.IAsyncDisposable</see></description></item>
404
443
/// <item><description>Allows <c>let!</c> for Tasks, ValueTasks, and any Awaitable Type</description></item>
405
444
/// <item><description>When Tasks throw exceptions they will use the behavior described in <see href="https://github.com/fsharp/fslang-suggestions/issues/840">Async.Await overload (esp. AwaitTask without throwing AggregateException)</see></description></item>
445
+
/// <item><description>Allow <c>for</c> on <see cref="T:System.Collections.Generic.IAsyncEnumerable`1">System.Collections.Generic.IAsyncDisposable</see></description></item>
0 commit comments