{"action":"created","issue":{"url":"https://api.github.com/repos/typelevel/cats/issues/1294","repository_url":"https://api.github.com/repos/typelevel/cats","labels_url":"https://api.github.com/repos/typelevel/cats/issues/1294/labels{/name}","comments_url":"https://api.github.com/repos/typelevel/cats/issues/1294/comments","events_url":"https://api.github.com/repos/typelevel/cats/issues/1294/events","html_url":"https://github.com/typelevel/cats/issues/1294","id":171632962,"number":1294,"title":"Add withFilter and filter to XorT","user":{"login":"mkotsbak","id":296523,"avatar_url":"https://avatars.githubusercontent.com/u/296523?v=3","gravatar_id":"","url":"https://api.github.com/users/mkotsbak","html_url":"https://github.com/mkotsbak","followers_url":"https://api.github.com/users/mkotsbak/followers","following_url":"https://api.github.com/users/mkotsbak/following{/other_user}","gists_url":"https://api.github.com/users/mkotsbak/gists{/gist_id}","starred_url":"https://api.github.com/users/mkotsbak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkotsbak/subscriptions","organizations_url":"https://api.github.com/users/mkotsbak/orgs","repos_url":"https://api.github.com/users/mkotsbak/repos","events_url":"https://api.github.com/users/mkotsbak/events{/privacy}","received_events_url":"https://api.github.com/users/mkotsbak/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-17T11:16:19Z","updated_at":"2016-08-18T12:34:53Z","closed_at":null,"body":"This will allow to use if statements in for-comprehensions. See similar issue for OptionT: https://github.com/typelevel/cats/issues/981"},"comment":{"url":"https://api.github.com/repos/typelevel/cats/issues/comments/240709420","html_url":"https://github.com/typelevel/cats/issues/1294#issuecomment-240709420","issue_url":"https://api.github.com/repos/typelevel/cats/issues/1294","id":240709420,"user":{"login":"ceedubs","id":977929,"avatar_url":"https://avatars.githubusercontent.com/u/977929?v=3","gravatar_id":"","url":"https://api.github.com/users/ceedubs","html_url":"https://github.com/ceedubs","followers_url":"https://api.github.com/users/ceedubs/followers","following_url":"https://api.github.com/users/ceedubs/following{/other_user}","gists_url":"https://api.github.com/users/ceedubs/gists{/gist_id}","starred_url":"https://api.github.com/users/ceedubs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ceedubs/subscriptions","organizations_url":"https://api.github.com/users/ceedubs/orgs","repos_url":"https://api.github.com/users/ceedubs/repos","events_url":"https://api.github.com/users/ceedubs/events{/privacy}","received_events_url":"https://api.github.com/users/ceedubs/received_events","type":"User","site_admin":false},"created_at":"2016-08-18T12:34:53Z","updated_at":"2016-08-18T12:34:53Z","body":"I think that `OptionT` is a bit different than `XorT` in this context. If you filter out an item from an `Option` then you can naturally return `None`. What do you return in the case of `Xor`/`XorT` for an empty value? `Xor` used to require a `Monoid` instance for the left type and use the `empty` value from that `Monoid`, but it was removed in #276 as it was pretty ad-hoc and arbitrary. For example what should the following return?\r\n\r\n```scala\r\nval x: String Xor Int = Right(3)\r\nval y = x.filter(_ % 2 == 0)\r\n```\r\n\r\nWith a `Monoid` `empty` it would return `Left(\"\")`. To me this seems pretty arbitrary and probably unhelpful. I think it's better to do something like:\r\n\r\n```\r\nval x: String Xor Int = Right(3)\r\nval y = x.ensure(\"oops it was odd!\")(_ % 2 == 0)\r\n```\r\n\r\nNote that I'm using `Xor` in these examples but I think it all applies equally well to `XorT`."}}
{"actor":{"display_login":"ceedubs"}}