-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
@adamgfraser brought this up, and it's something I was looking for as well. I wanted to create an issue so that it doesn't get lost.
We currently have foreachPar_ but not collectAllPar_. Should the latter be added for consistency?
If the aim is for perfect symmetry, there's also collectAllParN, collectAll, and so on.
You can always do .unit which is fine in many cases. Besides consistency though, the other motivation for this is that there's room for optimization in some of the _ variants since you don't need to collect the results.
As an aside, I find the collectAll_ name a bit awkward considering you're throwing away what you "collected". But I don't have any other ideas. Techinically you could safely add a new name for this and avoid _ altogether, but then you sort of lose the symmetry with foreach_.
If ZIO was in more early stages, I would have made the case for foreach returning Unit, while traverse returning the results... π But I know that's already been discussed to death and is too late now anyway.