Skip to content

New feature: For-comprehensions for Eithers and Validations #3063

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

adamkopec
Copy link
Contributor

Allows for Either and Validation usage in for-comprehensions, eg:

Either<Object, Integer> result = For(
                Either.right(1),
                Either.right(2),
                Either.right(3)
            ).yield((i1, i2, i3) -> i1 + i2 + i3);
            assertThat(result.get()).isEqualTo(6);

@adamkopec adamkopec requested a review from pivovarit as a code owner August 6, 2025 09:59
@pivovarit
Copy link
Member

This was very much lacking - thanks! I will give it a closer look and, quite likely, merge as is!

@pivovarit pivovarit added this to the v0.11.0 milestone Aug 7, 2025
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