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

Added a helper success case for Result<Void, Error> types #26471

Closed
wants to merge 2 commits into from

Conversation

bojanstef
Copy link

This change allows the following:

func foo(result: (Result<Void, Error>) -> ()) {
+  result(.success)
-  result(.success(()))
}

@theblixguy
Copy link
Collaborator

cc @jshier

@jshier
Copy link
Contributor

jshier commented Aug 3, 2019

I'd like to see this addition, as Result<Void, Failure> is fairly common and it feels awkward to keep having to write .success(()). However, I'm pretty sure that additions to the APIs of standard library types have to go through the evolution process. I have my own ideas for additions (tryMap, perhaps fold), so we may be able to combine all of the suggestions into a single pitch and proposal, but I won't have time to do it myself for a bit.

@bojanstef
Copy link
Author

Thanks @jshier, I was hoping I could squeeze this change in but if it has to go through the evolution process then so be it 😄

In the meantime, should I close this PR and start writing a proposal?

@rjmccall rjmccall added the swift evolution pending discussion Flag → feature: A feature that has a Swift evolution proposal currently in review label Aug 14, 2019
@hfhbd
Copy link

hfhbd commented Nov 24, 2019

Hey @bojanstef,
did you create a new pitch, to improve the Result type? If not, @jshier`s ideas and maybe my idea (#27908) could also be included.

@CodaFi
Copy link
Contributor

CodaFi commented Apr 15, 2020

@bojanstef Any movement here?

@bojanstef
Copy link
Author

@bojanstef Any movement here?

I haven’t done anything.

@shahmishal
Copy link
Member

Please update the base branch to main by Oct 5th otherwise the pull request will be closed automatically.

  • How to change the base branch: (Link)
  • More detail about the branch update: (Link)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
swift evolution pending discussion Flag → feature: A feature that has a Swift evolution proposal currently in review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants