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

Replace use of &&& with flatMap() #38

Merged
merged 4 commits into from
Sep 20, 2018

Conversation

kastiglione
Copy link
Contributor

@kastiglione kastiglione commented Sep 18, 2018

In order to build XCHammer with newer dependencies, the use of the deprecated &&& operator needs to be replaced. See antitypical/Result#220

This reduce() appears to have not been working, because it wasn't modifying the inout state.

EDIT: It seems that flatMap() is the correct operation here, not fanout() as I originally had.

@kastiglione kastiglione changed the title Replace use of &&& with fanout() Replace use of &&& with flatMap() Sep 19, 2018
@jerrymarino
Copy link
Collaborator

@kastiglione awesome - thanks for fixing this! I'm testing it out a few times this morning and will merge shortly 👍

result, element in
return result &&& element
})
return result.flatMap { _ in element }
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ok interesting - so Result has it's own flatMap that will effectively achieve the same result - this LGTM 👍

Copy link
Contributor Author

@kastiglione kastiglione Sep 20, 2018

Choose a reason for hiding this comment

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

Yeah, and Result's flatMap propagates instances of failure. The result of this reduce + flatMap is a Result that is success if all results were successes, or the first failure found. Based on the caller of this function, this seems like the best implementation.

@jerrymarino jerrymarino merged commit 455b3c3 into bazel-xcode:master Sep 20, 2018
@kastiglione kastiglione deleted the patch-1 branch September 22, 2018 03:41
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