Hildebrandt Tobias
08/17/2023, 12:48 PMJoffrey
08/17/2023, 12:55 PMJoffrey
08/17/2023, 12:56 PMFailFast
suffix or something like that.Hildebrandt Tobias
08/17/2023, 1:00 PMSam
08/17/2023, 1:02 PMHildebrandt Tobias
08/17/2023, 1:03 PMFailLazy
? 😄Hildebrandt Tobias
08/17/2023, 1:04 PMFailAfterCompletion
Sam
08/17/2023, 1:05 PMmapOrAccumulate
function in #arrow. Not sure how I would apply that naming to something that throws exceptions, though.Joffrey
08/17/2023, 1:05 PMtry-catch
and wrap in a custom result type so they get a list of all results, some of which being errorsJoffrey
08/17/2023, 1:07 PMconcurrentMap
or mapConcurrent
rather than "async", because async doesn't convey the fact that each item is processed concurrently. asyncMap
could just be a suspend function that still processes all elements sequentially (but suspends until the end of the loop)Joffrey
08/17/2023, 1:10 PMconcurrentMap
- processes each element concurrently, fails fast if one element's transform lambda fails. Basically the default behaviour of an implem with `coroutineScope`+`map`+`async`+`awaitAll()`
• Optionally, if you do want to streamline the result approach because you have lots of usages, a concurrentMapCatching
name could be an option (using runCatching
inside) - but I personally quite dislike using the Kotlin Result
type directly like this (and would rather encourage applicative code to declare its own result type with a name matching the business, and more importantly catching specific exceptions - not Throwable
!)Joffrey
08/17/2023, 1:13 PMHildebrandt Tobias
08/17/2023, 1:14 PMHildebrandt Tobias
08/17/2023, 1:16 PMSam
08/17/2023, 1:17 PMHildebrandt Tobias
08/17/2023, 1:17 PMJoffrey
08/17/2023, 1:30 PM