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 flatten_left and flatten_right #84

Closed
wants to merge 1 commit into from
Closed

Conversation

CMDJojo
Copy link

@CMDJojo CMDJojo commented May 2, 2023

This resolves #83 by adding flatten_left and flatten_right methods. I did not add a flatten method (like suggested in the issue) due to into_inner doing the same thing. (Also, rustfmt moved imports a bit, that's why those rows were changed)

@cuviper
Copy link
Member

cuviper commented Oct 27, 2023

First, sorry I never responded here for so long!

Rather than using self.either(identity, Right) and vice versa, you could also write these as:

  • flatten_left => self.left_or_else(Right)
  • flatten_right => self.right_or_else(Left)

To me, these existing methods already seem sufficient. Are there common cases where nested Either comes up that these really deserve dedicated methods?

@cuviper cuviper closed this Jan 19, 2024
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.

Add flatten, flatten_right and flatten_left methods
2 participants