{"action":"created","issue":{"url":"https://api.github.com/repos/scala/bug/issues/10285","repository_url":"https://api.github.com/repos/scala/bug","labels_url":"https://api.github.com/repos/scala/bug/issues/10285/labels{/name}","comments_url":"https://api.github.com/repos/scala/bug/issues/10285/comments","events_url":"https://api.github.com/repos/scala/bug/issues/10285/events","html_url":"https://github.com/scala/bug/issues/10285","id":224544693,"number":10285,"title":"Weirdness in Either projections","user":{"login":"Blaisorblade","id":289960,"avatar_url":"https://avatars0.githubusercontent.com/u/289960?v=3","gravatar_id":"","url":"https://api.github.com/users/Blaisorblade","html_url":"https://github.com/Blaisorblade","followers_url":"https://api.github.com/users/Blaisorblade/followers","following_url":"https://api.github.com/users/Blaisorblade/following{/other_user}","gists_url":"https://api.github.com/users/Blaisorblade/gists{/gist_id}","starred_url":"https://api.github.com/users/Blaisorblade/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Blaisorblade/subscriptions","organizations_url":"https://api.github.com/users/Blaisorblade/orgs","repos_url":"https://api.github.com/users/Blaisorblade/repos","events_url":"https://api.github.com/users/Blaisorblade/events{/privacy}","received_events_url":"https://api.github.com/users/Blaisorblade/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-04-26T17:34:36Z","updated_at":"2017-04-27T12:15:49Z","closed_at":null,"body":"I can't wrap my head around Either.right.filter. Compare these two variants:\r\n```\r\nscala> Right(1).right.filter(x => true).map(x => x)\r\nres4: Option[scala.util.Either[Nothing,Int]] = Some(Right(1))\r\n\r\nscala> Right(1).right.map(x => x)\r\nres5: scala.util.Either[Nothing,Int] = Right(1)\r\n```\r\nSo `filter` suggests `right` gives an `Option[Either[A, B]]`, while `map` suggests `right` gives an `Either[A, B]`. Weird, huh?\r\n\r\nIf it had a `withFilter` aliasing `filter`, you could write the above also as for comprehensions, as you could till 2.11:\r\n```\r\nscala> for (x <- Right(1).right) yield x\r\nres0: scala.util.Either[Nothing,Int] = Right(1)\r\n\r\nscala> for (x <- Right(1).right; if true) yield x\r\n<console>:12: error: value withFilter is not a member of scala.util.Either.RightProjection[Nothing,Int]\r\n       for (x <- Right(1).right; if true) yield x\r\n                          ^\r\n```\r\nThe only previous semi-related discussion was in https://github.com/scala/bug/issues/5793.\r\n\r\nThis came up while re-debugging https://github.com/scala/bug/issues/5589."},"comment":{"url":"https://api.github.com/repos/scala/bug/issues/comments/297696573","html_url":"https://github.com/scala/bug/issues/10285#issuecomment-297696573","issue_url":"https://api.github.com/repos/scala/bug/issues/10285","id":297696573,"user":{"login":"Blaisorblade","id":289960,"avatar_url":"https://avatars0.githubusercontent.com/u/289960?v=3","gravatar_id":"","url":"https://api.github.com/users/Blaisorblade","html_url":"https://github.com/Blaisorblade","followers_url":"https://api.github.com/users/Blaisorblade/followers","following_url":"https://api.github.com/users/Blaisorblade/following{/other_user}","gists_url":"https://api.github.com/users/Blaisorblade/gists{/gist_id}","starred_url":"https://api.github.com/users/Blaisorblade/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Blaisorblade/subscriptions","organizations_url":"https://api.github.com/users/Blaisorblade/orgs","repos_url":"https://api.github.com/users/Blaisorblade/repos","events_url":"https://api.github.com/users/Blaisorblade/events{/privacy}","received_events_url":"https://api.github.com/users/Blaisorblade/received_events","type":"User","site_admin":false},"created_at":"2017-04-27T12:15:49Z","updated_at":"2017-04-27T12:15:49Z","body":"Yeah, I should have been clearer. I know that's a good question. I'm just saying that since you can't answer it within the \"standard\" filter interface, then it'd be better use another name instead of filter. Waiting for that, we could add a warning."}}
{"actor":{"display_login":"Blaisorblade"}}