Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Consider adding collectAllPar_?Β #3140

@reibitto

Description

@reibitto

@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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions