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
{{ message }}
Repository navigation
Question: get the first success from Async<Result<'ok, 'error>> list? #340
I don't think anything like this is available currently. It feels like a derivative of List.tryPick but accumulates errors. Maybe we should make that available with an additional helper to yield if the list is already a group
moduleList =moduleAsyncResult =lettryPick f tasks =async{let mutableerrors= ListCollector()let mutableresult= ValueNone
for task in tasks |> List.takeWhile (fun _ -> result.IsNone)domatch! f task with| Ok t -> result <- ValueSome(Ok t)| Error error -> errors.Add error
match result with| ValueSome okResult ->return okResult
| ValueNone ->return Error(errors.Close())}lettryYield tasks = tryPick id tasks
Activity
TheAngryByrd commentedon Sep 24, 2025
I don't think anything like this is available currently. It feels like a derivative of
List.tryPickbut accumulates errors. Maybe we should make that available with an additional helper to yield if the list is already a groupnjlr commentedon Sep 29, 2025
Hmmm does this make it part of
AsyncValidationthen?TheAngryByrd commentedon Sep 29, 2025
Yeah probably.