Un-deprecate left Either projections#8012
Merged
adriaanm merged 2 commits intoscala:2.13.xfrom May 2, 2019
nrinaudo:undepreated-either-left
Merged
Un-deprecate left Either projections#8012adriaanm merged 2 commits intoscala:2.13.xfrom nrinaudo:undepreated-either-left
adriaanm merged 2 commits intoscala:2.13.xfrom
nrinaudo:undepreated-either-left
Conversation
Member
|
the previous discussion was at #6682 |
hrhino
approved these changes
Apr 29, 2019
Contributor
hrhino
left a comment
There was a problem hiding this comment.
I'm okay with this. I'd like that we consider introducing mapLeft or what have you in 2.14, but this combinator has its place IMO.
Contributor
|
With the amount of support I'm seeing for this, let's go for undeprecating. There is no rush. I think there is space for a nicer, more symmetric design, but let's explore that for 2.14.x |
Contributor
Author
|
@martijnhoekstra to be clear: I completely agree that projections should disappear. I do feel, however, that they shouldn't take away useful combinators with them. |
julienrf
reviewed
Apr 30, 2019
nrinaudo
commented
Apr 30, 2019
julienrf
approved these changes
Apr 30, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Deprecating right projections makes sense -
Eitheris now right-biased, there's no need for them.Deprecating left projections also seems desirable, but I feel this might have been done a bit quickly, with some unpleasant consequences.
There are existing scenarios where one might want to call
.left.map(f)or.left.flatMap(g)-flatMapis particularly useful to recover on errors, for example.The current state of scala means that we'll get a warning for this (or, for the
-Xfatal-warningscrowd, an error) without a clear workaround. Suggestions on scala/contributors were:Both of these work fine, but I doubt anyone who has to replace
e.left.flatMap(f)by one of them will feel it's a step forward.Truth be told, I'd rather see projections disappear and
EithergetleftMapandleftFlatMapmethods, but it's a bit late for that, with the 2.13.0 API being frozen.