Open Caleb9 opened 2 years ago
Isn't Async.head
the same as Async.first
, which already exists? Well, firstOrDefault
exists, which is close enough, no? https://fsprojects.github.io/FSharp.Control.AsyncSeq/reference/fsharp-control-asyncseq.html#firstOrDefault
Though there's no tail
. There should probably be a tail
and tryTail
pair, and yes, maybe it does make sense to have a head
and tryHead
for parity with Seq
.
It sure is, it's just a slight inconsistency with non-async collections API (i.e. Seq
has head
and tail
). It's no biggie, the PR can be closed if it's not desirable to have these two APIs aligned in this way :).
FWIW, TaskSeq
, which uses a resumable state machine and task
from F# 6 under the hood, and implements IAsyncEnumerable<_>
similar to async foreach
in C#, has those functions: https://github.com/fsprojects/FSharp.Control.TaskSeq
@abelbraaksma Should we close this old one out?
Hello!
Regular
Seq
contains simple convenience functionshead
andtail
. I implemented those forAsyncSeq
, maybe they could be added?Thanks.