Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Filter To ForEach #1211

Merged
merged 4 commits into from
Oct 10, 2023
Merged

Move Filter To ForEach #1211

merged 4 commits into from
Oct 10, 2023

Conversation

adamgfraser
Copy link
Contributor

No description provided.

@adamgfraser adamgfraser requested a review from a team as a code owner October 8, 2023 20:36
sideeffffect
sideeffffect previously approved these changes Oct 9, 2023
Copy link
Member

@sideeffffect sideeffffect left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We seem to have lost withFilter. Otherwise the code looks fine. But what was the motivation, if you don't mind me asking?

@adamgfraser
Copy link
Contributor Author

It allows the effect type to be different than the collection type.

Copy link
Member

@sideeffffect sideeffffect left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool

@@ -488,6 +570,8 @@ trait ForEachSyntax {
F.sum(self)
def toChunk(implicit F: ForEach[F]): Chunk[A] =
F.toChunk(self)
def withFilter(f: A => Boolean)(implicit F: ForEach[F], I: IdentityEither[F], B: IdentityBoth[F]): F[A] =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can add the comment

// Provides support for filtering `F[A]` values in for comphrensions.

@adamgfraser adamgfraser merged commit a9bdbcf into zio:series/2.x Oct 10, 2023
@adamgfraser adamgfraser deleted the filter branch October 10, 2023 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants