TaskEx: AwaitTaskCorrect / Task.toAsync / Async.ofTask
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 35/100
- Issue-Typ
- Feature
- Klarheit
- Muss geklärt werden
- Aktivitätsstatus
- Ruhig
- Tech-Stack
- fsharp
- Bereich
- backend
Rechercherichtung
Beginne mit dem Lesen der vorgeschlagenen APIs, der abgelösten Issues 129 und 139 sowie des verknüpften fslang-suggestion. Vergleiche die kanonischen Implementierungskopien in Equinox, Propulsion und FSharp.AWS.DynamoDB. Als abgeschlossen gilt die Arbeit, wenn eine abgestimmte API sowie Semantik für Abbruch und Ausnahmen vorliegen, die für eine gemeinsame Implementierung geeignet sind.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Replaces https://github.com/fsprojects/FSharp.Control.TaskSeq/issues/129. TaskEx top level issue: https://github.com/fsprojects/FSharp.Control.TaskSeq/issues/139
The default implementation of the Async.AwaitTask methods in FSharp.Core have some key shortcomings:
- when the
Taskfaults, yielding an exception, that exception is typically (always?) wrapped in an egregiousAggregateException - the default implementation does not abort/cancel when the ambient
CancellationTokenof theasyncexpr within whichAsync.AwaitTaskis triggered - cancelling an Async computation should not just abort the processing, it should also propagate a
TaskCancelledExceptionto align with the behavior ofTask
While it can be argued that the current behavior is 'wrong', it's also obvious that breaking it would be untenable, and the semantic differences are beyond what one might cover with subtle overloads and/or adding optional arguments etc.
Current proposed APIs (will be updated inline based on any discussion below):
module Async =
let inline ofTask (t : Task<'t>) : Async<'t> = AwaitTaskCorrect t
let inline ofUnitTask (t : Task) : Async<'t> = AwaitTaskCorrect t
module Task =
let inline toAsync (t : Task<'t>) : Async<'t> = Async.ofTask t
NOTES:
- the above naming is taken from the helpers within
TaskSeq, which are exposed in theFSharp.Controlnamespace. NOTE the current implementations useAsync.AwaitTask, but that was not as a conscious choice, and there is a desire` to fix at least some of the shortcomings noted - given the fact that
taskandasyncare now first class citizens ofFSharp.Core, having anof/topairing would seem to make sense. This is open to debate; not sure the degree to which the prior art is consistent wrt this beyond collection types/modules - There is an
fslang-suggestionregarding this. The purpose of this issue is as a placeholder for potentially filling the gap until this issue can be more thoroughly resolved inFSharp.Coreproper. - Equinox, Propulsion and FSharp.AWS.DynamoDB all have copies of the canonical impl in Eirik's fssnip. Not ruling out tweaks to the semantics, but ideally those libraries, and others, would all share the same semantics
- if this is handled as a
module, one also frequently needs anofUnitTaskalongside as above (Async.AwaitTask is a pair of overloaded methods, which often brings its own issues with intellisense and error messages etc)
- Vorherrschende Sprache
- F#
- Sterne
- 111
- Forks
- 13
- Ø Merge
- 7 Std. 59 Min.
- Gemergte PRs (30 T.)
- 3
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus fsprojects/FSharp.Control.TaskSeq
-
agentic-workflows automation repo-assist
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
-
agentic-workflows automation repo-assist
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 35/100
fsprojects/FSharp.Control.TaskSeq#476 · 1 Kommentar ·
-
bug
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 45/100
fsprojects/FSharp.Control.TaskSeq#473 · 1 Kommentar · 1 Reaktion ·
-
automation enhancement repo-assist
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 10/100
-
enhancement needs triage
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 45/100
Alle Issues in fsprojects/FSharp.Control.TaskSeq
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
-
external-issue to-triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
googleapis/google-cloud-swift#1151 ·
-
external
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
langchain-ai/langgraph#9074 · 1 Kommentar ·
-
documentation specification
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 90/100
openai/openai-openapi#584 ·