fsprojects / FSharp.Control.TaskSeq

A computation expression and module for seamless working with IAsyncEnumerable<'T> as if it is just another sequence
MIT License
91 stars 7 forks source link

Implement `TaskSeq.insertAt`, `updateAt`, `removeAt`, `insertManyAt`, `removeManyAt` #236

Closed abelbraaksma closed 5 months ago

abelbraaksma commented 6 months ago

Part of the push for good coverage of surface area functions, see #208 for an overview. This implements insertAt, updateAt, removeAt, insertManyAt, removeManyAt and maxByAsync.

We won't be implementing updateManyAt unless there's a strong use case. We skip it for the same reasons it was skipped in FSharp.Core for Seq: https://github.com/fsharp/fslang-suggestions/issues/1047#issuecomment-894227703.

Each of these behave exactly like their Seq counterparts:

As before, the xml doc blibs have been taken from seq.fs and modified a bit for readability and applicability to TaskSeq.

The signatures are as follows:

static member insertAt: index: int -> value: 'T -> source: TaskSeq<'T> -> TaskSeq<'T>
static member insertManyAt: index: int -> values: TaskSeq<'T> -> source: TaskSeq<'T> -> TaskSeq<'T>

static member removeAt: index: int -> source: TaskSeq<'T> -> TaskSeq<'T>
static member removeManyAt: index: int -> count: int -> source: TaskSeq<'T> -> TaskSeq<'T>

static member updateAt: index: int -> value: 'T -> source: TaskSeq<'T> -> TaskSeq<'T>

TODO list:

abelbraaksma commented 5 months ago

This is ready. Now all that's left is forall and the release notes, and then we can publish the new version finally.