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

Add withFilter to FunctorFilter.Ops #4709

Open
ikeyan opened this issue Jan 28, 2025 · 1 comment
Open

Add withFilter to FunctorFilter.Ops #4709

ikeyan opened this issue Jan 28, 2025 · 1 comment

Comments

@ikeyan
Copy link

ikeyan commented Jan 28, 2025

So for-comprehension with if clauses compiles.

for {
  n <- Try(Seq(1, 2, 3)).nested if n % 2 == 0
} yield n
@BartekBH
Copy link

BartekBH commented Feb 1, 2025

I would like to do this if someone can confirm that it is needed.

EDIT: I took a look at it and added a simple implementation of withFilter based on the standard filter. I added standard function in FunctorFilter trait with comment, and target version in Ops but it is maybe redundand. Additionally, I added a basic test - 'withFilter filter consistency' law.
Now the if statement in the for-comprehension works. However, I'm not sure if this is sufficient; I might be missing something, and it may not be that straightforward.

I don't want to clutter the repository with unnecessary PRs, so if someone could review this comment and approve the approach, I can push my code.

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

No branches or pull requests

2 participants