Skip to content

Commit f0c4ea3

Browse files
Apply review comments
Co-Authored-By: Ruben Bartelink <[email protected]>
1 parent 4db8bc2 commit f0c4ea3

File tree

1 file changed

+21
-22
lines changed

1 file changed

+21
-22
lines changed

README.md

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -166,34 +166,33 @@ let feedFromTwitter user pwd = taskSeq {
166166

167167
## Choosing between `AsyncSeq` and `TaskSeq`
168168

169-
The [`AsyncSeq`][11] and `TaskSeq` library both operate on asynchronous sequences, but there are a few fundamental differences, most notably that the former _does not_ implement `IAsyncEnumerable<'T>`, but has its own same-named, but differently behaving type. Another core difference is that `TaskSeq` uses `ValueTasks` for the asynchronous computations, and `AsyncSeq` uses F#'s `Async<'T>`.
169+
The [`AsyncSeq`][11] and `TaskSeq` libraries both operate on asynchronous sequences, but there are a few fundamental differences. The most notable being that the former _does not_ implement `IAsyncEnumerable<'T>`, though it does have a type of that name with different semantics (not surprising; it predates the definition of the modern one). Another key difference is that `TaskSeq` uses `ValueTask`s for the asynchronous computations, whereas `AsyncSeq` uses F#'s `Async<'T>`.
170170

171171
There are more differences:
172172

173-
| | `TaskSeq` | `AsyncSeq` |
174-
|----------------------------|---------------------------------------------------------------------------------------|----------------------------------------------------------------------|
175-
| **Frameworks** | .NET 5.0+, NetStandard 2.1 | .NET 5.0+, NetStandard 2.0 and 2.1, .NET Framework 4.6.1+ |
176-
| **Underlying type** | `System.Collections.Generic.IAsyncEnumerable<'T>` | Its own type, also called `IAsyncEnumerable<'T>`, but not compatible |
177-
| **Implementation** | State machine (statically compiled) | No state machine, continuation style |
178-
| **Semantics** | `seq`-like: on-demand | `seq`-like: on-demand |
179-
| **Support `let!`** | All `task`-like: `Async<'T>`, `ValueTask<'T>`, `Task<'T>` or any `GetAwaiter()` | `Async<'T>` only |
180-
| **Support `do!`** | `Async<unit>`, `Task<unit>` and `Task`, `ValueTask<unit>` and `ValueTask` | `Async<unit>` only |
181-
| **Support `yield!`** | `IAsyncEnumerable<'T>`, `AsyncSeq`, any sequence | `AsyncSeq` |
182-
| **Support `for`** | `IAsyncEnumerable<'T>`, `AsyncSeq`, any sequence | `AsyncSeq` any sequence |
183-
| **Behavior with `yield`** | Zero allocations, no `Task` or even `ValueTask` created | Allocated, an F# `Async` wrapped in a singleton `AsyncSeq` |
184-
| **Conversion to other** | `TaskSeq.toAsyncSeq` | `AsyncSeq.toAsyncEnum` |
185-
| **Conversion from other** | Implicit (yield!) or `TaskSeq.ofAsyncSeq` | `AsyncSeq.ofAsyncEnum` |
186-
| **Recursion in `yield!`** | No (requires F# support, upcoming) | Yes |
187-
| **Based on F# concept of** | `task` | `async` |
188-
| **`MoveNextAsync`** | `ValueTask<bool>` | `Async<'T option>` |
189-
| **`Current` internals** | `ValueOption<'T>` | `Option<'T>` |
190-
| **Cancellation** | Implicit token governing iteration | Implicit token passed to each subtask |
191-
| **Performance** | Very high, negligible allocations | Slower, more allocations, due to using `async` |
192-
| **Parallelism** | Possible with ChildTask, support will follow | Supported explicitly |
173+
| | `TaskSeq` | `AsyncSeq` |
174+
|----------------------------|---------------------------------------------------------------------------------|----------------------------------------------------------------------|
175+
| **Frameworks** | .NET 5.0+, NetStandard 2.1 | .NET 5.0+, NetStandard 2.0 and 2.1, .NET Framework 4.6.1+ |
176+
| **Underlying type** | `System.Collections.Generic.IAsyncEnumerable<'T>` | Its own type, also called `IAsyncEnumerable<'T>`, but not compatible |
177+
| **Implementation** | State machine (statically compiled) | No state machine, continuation style |
178+
| **Semantics** | `seq`-like: on-demand | `seq`-like: on-demand |
179+
| **Support `let!`** | All `task`-like: `Async<'T>`, `Task<'T>`, `ValueTask<'T>` or any `GetAwaiter()` | `Async<'T>` only |
180+
| **Support `do!`** | `Async<unit>`, `Task<unit>` and `Task`, `ValueTask<unit>` and `ValueTask` | `Async<unit>` only |
181+
| **Support `yield!`** | `IAsyncEnumerable<'T>`, `AsyncSeq`, any sequence | `AsyncSeq` |
182+
| **Support `for`** | `IAsyncEnumerable<'T>`, `AsyncSeq`, any sequence | `AsyncSeq`, any sequence |
183+
| **Behavior with `yield`** | Zero allocations; no `Task` or even `ValueTask` created | Allocates an F# `Async` wrapped in a singleton `AsyncSeq` |
184+
| **Conversion to other** | `TaskSeq.toAsyncSeq` | `AsyncSeq.toAsyncEnum` |
185+
| **Conversion from other** | Implicit (`yield!`) or `TaskSeq.ofAsyncSeq` | `AsyncSeq.ofAsyncEnum` |
186+
| **Recursion in `yield!`** | **No** (requires F# support, upcoming) | Yes |
187+
| **Based on F# concept of** | `task` | `async` |
188+
| **`MoveNextAsync`** impl | `ValueTask<bool>` | `Async<'T option>` |
189+
| **Cancellation** | Implicit token governing iteration | Implicit token passed to each subtask |
190+
| **Performance** | Very high, negligible allocations | Slower, more allocations, due to using `async` |
191+
| **Parallelism** | Possible with ChildTask; support will follow | Supported explicitly |
193192

194193
## Status & planning
195194

196-
This project has stable features currently, but before we go full "version one", we'd like to complete the surface area. This section covers the status of that, with a full list of implmented functions below. Here's the short list:
195+
This project has stable features currently, but before we go full "version one", we'd like to complete the surface area. This section covers the status of that, with a full list of implemented functions below. Here's the shortlist:
197196

198197
- [x] Stabilize and battle-test `taskSeq` resumable code. **DONE**
199198
- [x] A growing set of module functions `TaskSeq`, see below for progress. **DONE & IN PROGRESS**

0 commit comments

Comments
 (0)