{"action":"closed","number":45,"pull_request":{"url":"https://api.github.com/repos/funcool/cats/pulls/45","id":38192067,"html_url":"https://github.com/funcool/cats/pull/45","diff_url":"https://github.com/funcool/cats/pull/45.diff","patch_url":"https://github.com/funcool/cats/pull/45.patch","issue_url":"https://api.github.com/repos/funcool/cats/issues/45","number":45,"state":"closed","locked":false,"title":"Add branch-left and branch-right","user":{"login":"yurrriq","id":1866448,"avatar_url":"https://avatars.githubusercontent.com/u/1866448?v=3","gravatar_id":"","url":"https://api.github.com/users/yurrriq","html_url":"https://github.com/yurrriq","followers_url":"https://api.github.com/users/yurrriq/followers","following_url":"https://api.github.com/users/yurrriq/following{/other_user}","gists_url":"https://api.github.com/users/yurrriq/gists{/gist_id}","starred_url":"https://api.github.com/users/yurrriq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yurrriq/subscriptions","organizations_url":"https://api.github.com/users/yurrriq/orgs","repos_url":"https://api.github.com/users/yurrriq/repos","events_url":"https://api.github.com/users/yurrriq/events{/privacy}","received_events_url":"https://api.github.com/users/yurrriq/received_events","type":"User","site_admin":false},"body":"When using [cats][1], specifically [the either monad][2], I often find myself writing code like:\r\n\r\n```clojure\r\n(branch either-value\r\n  (fn [value]\r\n    (comment \"Handle a left value\"))\r\n  ;; Pass a right value\r\n  right)\r\n```\r\n\r\nFor this case, I thought it would be better if `(branch e f right)` were abstracted away, and that's precisely what I've done in [`#'cats.monad.either/branch-left`][3].\r\n\r\nIn the interest of symmetry and completeness, I also implemented [`#'cats.monad.either/branch-right`][4], which is effectively an either-specific synonym of [`#'cats.core/bind`][5].\r\n\r\nThe functionality is loosely based on ideas in the [either package][6] for Haskell.\r\nSee also: [`Data.Either.Combinators`][7]\r\n\r\n\r\n[1]: https://github.com/funcool/cats\r\n[2]: https:/github.com/funcool/cats/blob/master/src/cats/monad/either.cljc\r\n[3]: https://github.com/yurrriq/cats/blob/1c21682052ceff254545e23cbd4015ef74b071f8/src/cats/monad/either.cljc#L228-L234\r\n[4]: https://github.com/yurrriq/cats/blob/1c21682052ceff254545e23cbd4015ef74b071f8/src/cats/monad/either.cljc#L236-L242\r\n[5]: https://github.com/funcool/cats/blob/5accd7c937d1cdea9391a828dcdd41e41b6e83f8/src/cats/core.cljc#L117-L139\r\n[6]: https://hackage.haskell.org/package/either-4.4.1\r\n[7]: https://hackage.haskell.org/package/either-4.4.1/docs/Data-Either-Combinators.html\r\n","created_at":"2015-06-21T22:39:08Z","updated_at":"2015-06-22T07:21:23Z","closed_at":"2015-06-22T07:21:23Z","merged_at":"2015-06-22T07:21:23Z","merge_commit_sha":"61a864d0b5e7a2d132ae8c6155653ce58be5a124","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/funcool/cats/pulls/45/commits","review_comments_url":"https://api.github.com/repos/funcool/cats/pulls/45/comments","review_comment_url":"https://api.github.com/repos/funcool/cats/pulls/comments{/number}","comments_url":"https://api.github.com/repos/funcool/cats/issues/45/comments","statuses_url":"https://api.github.com/repos/funcool/cats/statuses/f5b45e972891f0780739d371230906e74c03cf6f","head":{"label":"yurrriq:more-either-branching","ref":"more-either-branching","sha":"f5b45e972891f0780739d371230906e74c03cf6f","user":{"login":"yurrriq","id":1866448,"avatar_url":"https://avatars.githubusercontent.com/u/1866448?v=3","gravatar_id":"","url":"https://api.github.com/users/yurrriq","html_url":"https://github.com/yurrriq","followers_url":"https://api.github.com/users/yurrriq/followers","following_url":"https://api.github.com/users/yurrriq/following{/other_user}","gists_url":"https://api.github.com/users/yurrriq/gists{/gist_id}","starred_url":"https://api.github.com/users/yurrriq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yurrriq/subscriptions","organizations_url":"https://api.github.com/users/yurrriq/orgs","repos_url":"https://api.github.com/users/yurrriq/repos","events_url":"https://api.github.com/users/yurrriq/events{/privacy}","received_events_url":"https://api.github.com/users/yurrriq/received_events","type":"User","site_admin":false},"repo":{"id":34879011,"name":"cats","full_name":"yurrriq/cats","owner":{"login":"yurrriq","id":1866448,"avatar_url":"https://avatars.githubusercontent.com/u/1866448?v=3","gravatar_id":"","url":"https://api.github.com/users/yurrriq","html_url":"https://github.com/yurrriq","followers_url":"https://api.github.com/users/yurrriq/followers","following_url":"https://api.github.com/users/yurrriq/following{/other_user}","gists_url":"https://api.github.com/users/yurrriq/gists{/gist_id}","starred_url":"https://api.github.com/users/yurrriq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yurrriq/subscriptions","organizations_url":"https://api.github.com/users/yurrriq/orgs","repos_url":"https://api.github.com/users/yurrriq/repos","events_url":"https://api.github.com/users/yurrriq/events{/privacy}","received_events_url":"https://api.github.com/users/yurrriq/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yurrriq/cats","description":"Category Theory and algebraic abstractions for Clojure.","fork":true,"url":"https://api.github.com/repos/yurrriq/cats","forks_url":"https://api.github.com/repos/yurrriq/cats/forks","keys_url":"https://api.github.com/repos/yurrriq/cats/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yurrriq/cats/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yurrriq/cats/teams","hooks_url":"https://api.github.com/repos/yurrriq/cats/hooks","issue_events_url":"https://api.github.com/repos/yurrriq/cats/issues/events{/number}","events_url":"https://api.github.com/repos/yurrriq/cats/events","assignees_url":"https://api.github.com/repos/yurrriq/cats/assignees{/user}","branches_url":"https://api.github.com/repos/yurrriq/cats/branches{/branch}","tags_url":"https://api.github.com/repos/yurrriq/cats/tags","blobs_url":"https://api.github.com/repos/yurrriq/cats/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yurrriq/cats/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yurrriq/cats/git/refs{/sha}","trees_url":"https://api.github.com/repos/yurrriq/cats/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yurrriq/cats/statuses/{sha}","languages_url":"https://api.github.com/repos/yurrriq/cats/languages","stargazers_url":"https://api.github.com/repos/yurrriq/cats/stargazers","contributors_url":"https://api.github.com/repos/yurrriq/cats/contributors","subscribers_url":"https://api.github.com/repos/yurrriq/cats/subscribers","subscription_url":"https://api.github.com/repos/yurrriq/cats/subscription","commits_url":"https://api.github.com/repos/yurrriq/cats/commits{/sha}","git_commits_url":"https://api.github.com/repos/yurrriq/cats/git/commits{/sha}","comments_url":"https://api.github.com/repos/yurrriq/cats/comments{/number}","issue_comment_url":"https://api.github.com/repos/yurrriq/cats/issues/comments{/number}","contents_url":"https://api.github.com/repos/yurrriq/cats/contents/{+path}","compare_url":"https://api.github.com/repos/yurrriq/cats/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yurrriq/cats/merges","archive_url":"https://api.github.com/repos/yurrriq/cats/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yurrriq/cats/downloads","issues_url":"https://api.github.com/repos/yurrriq/cats/issues{/number}","pulls_url":"https://api.github.com/repos/yurrriq/cats/pulls{/number}","milestones_url":"https://api.github.com/repos/yurrriq/cats/milestones{/number}","notifications_url":"https://api.github.com/repos/yurrriq/cats/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yurrriq/cats/labels{/name}","releases_url":"https://api.github.com/repos/yurrriq/cats/releases{/id}","created_at":"2015-04-30T22:03:37Z","updated_at":"2015-04-30T22:19:08Z","pushed_at":"2015-06-21T22:40:34Z","git_url":"git://github.com/yurrriq/cats.git","ssh_url":"git@github.com:yurrriq/cats.git","clone_url":"https://github.com/yurrriq/cats.git","svn_url":"https://github.com/yurrriq/cats","homepage":"http://funcool.github.io/cats/latest/","size":770,"stargazers_count":0,"watchers_count":0,"language":"Clojure","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"funcool:master","ref":"master","sha":"5accd7c937d1cdea9391a828dcdd41e41b6e83f8","user":{"login":"funcool","id":10117366,"avatar_url":"https://avatars.githubusercontent.com/u/10117366?v=3","gravatar_id":"","url":"https://api.github.com/users/funcool","html_url":"https://github.com/funcool","followers_url":"https://api.github.com/users/funcool/followers","following_url":"https://api.github.com/users/funcool/following{/other_user}","gists_url":"https://api.github.com/users/funcool/gists{/gist_id}","starred_url":"https://api.github.com/users/funcool/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/funcool/subscriptions","organizations_url":"https://api.github.com/users/funcool/orgs","repos_url":"https://api.github.com/users/funcool/repos","events_url":"https://api.github.com/users/funcool/events{/privacy}","received_events_url":"https://api.github.com/users/funcool/received_events","type":"Organization","site_admin":false},"repo":{"id":20815029,"name":"cats","full_name":"funcool/cats","owner":{"login":"funcool","id":10117366,"avatar_url":"https://avatars.githubusercontent.com/u/10117366?v=3","gravatar_id":"","url":"https://api.github.com/users/funcool","html_url":"https://github.com/funcool","followers_url":"https://api.github.com/users/funcool/followers","following_url":"https://api.github.com/users/funcool/following{/other_user}","gists_url":"https://api.github.com/users/funcool/gists{/gist_id}","starred_url":"https://api.github.com/users/funcool/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/funcool/subscriptions","organizations_url":"https://api.github.com/users/funcool/orgs","repos_url":"https://api.github.com/users/funcool/repos","events_url":"https://api.github.com/users/funcool/events{/privacy}","received_events_url":"https://api.github.com/users/funcool/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/funcool/cats","description":"Category Theory and algebraic abstractions for Clojure.","fork":false,"url":"https://api.github.com/repos/funcool/cats","forks_url":"https://api.github.com/repos/funcool/cats/forks","keys_url":"https://api.github.com/repos/funcool/cats/keys{/key_id}","collaborators_url":"https://api.github.com/repos/funcool/cats/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/funcool/cats/teams","hooks_url":"https://api.github.com/repos/funcool/cats/hooks","issue_events_url":"https://api.github.com/repos/funcool/cats/issues/events{/number}","events_url":"https://api.github.com/repos/funcool/cats/events","assignees_url":"https://api.github.com/repos/funcool/cats/assignees{/user}","branches_url":"https://api.github.com/repos/funcool/cats/branches{/branch}","tags_url":"https://api.github.com/repos/funcool/cats/tags","blobs_url":"https://api.github.com/repos/funcool/cats/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/funcool/cats/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/funcool/cats/git/refs{/sha}","trees_url":"https://api.github.com/repos/funcool/cats/git/trees{/sha}","statuses_url":"https://api.github.com/repos/funcool/cats/statuses/{sha}","languages_url":"https://api.github.com/repos/funcool/cats/languages","stargazers_url":"https://api.github.com/repos/funcool/cats/stargazers","contributors_url":"https://api.github.com/repos/funcool/cats/contributors","subscribers_url":"https://api.github.com/repos/funcool/cats/subscribers","subscription_url":"https://api.github.com/repos/funcool/cats/subscription","commits_url":"https://api.github.com/repos/funcool/cats/commits{/sha}","git_commits_url":"https://api.github.com/repos/funcool/cats/git/commits{/sha}","comments_url":"https://api.github.com/repos/funcool/cats/comments{/number}","issue_comment_url":"https://api.github.com/repos/funcool/cats/issues/comments{/number}","contents_url":"https://api.github.com/repos/funcool/cats/contents/{+path}","compare_url":"https://api.github.com/repos/funcool/cats/compare/{base}...{head}","merges_url":"https://api.github.com/repos/funcool/cats/merges","archive_url":"https://api.github.com/repos/funcool/cats/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/funcool/cats/downloads","issues_url":"https://api.github.com/repos/funcool/cats/issues{/number}","pulls_url":"https://api.github.com/repos/funcool/cats/pulls{/number}","milestones_url":"https://api.github.com/repos/funcool/cats/milestones{/number}","notifications_url":"https://api.github.com/repos/funcool/cats/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/funcool/cats/labels{/name}","releases_url":"https://api.github.com/repos/funcool/cats/releases{/id}","created_at":"2014-06-13T19:15:40Z","updated_at":"2015-06-18T15:50:07Z","pushed_at":"2015-06-22T07:21:23Z","git_url":"git://github.com/funcool/cats.git","ssh_url":"git@github.com:funcool/cats.git","clone_url":"https://github.com/funcool/cats.git","svn_url":"https://github.com/funcool/cats","homepage":"http://funcool.github.io/cats/latest/","size":1916,"stargazers_count":185,"watchers_count":185,"language":"Clojure","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":15,"mirror_url":null,"open_issues_count":2,"forks":15,"open_issues":2,"watchers":185,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/funcool/cats/pulls/45"},"html":{"href":"https://github.com/funcool/cats/pull/45"},"issue":{"href":"https://api.github.com/repos/funcool/cats/issues/45"},"comments":{"href":"https://api.github.com/repos/funcool/cats/issues/45/comments"},"review_comments":{"href":"https://api.github.com/repos/funcool/cats/pulls/45/comments"},"review_comment":{"href":"https://api.github.com/repos/funcool/cats/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/funcool/cats/pulls/45/commits"},"statuses":{"href":"https://api.github.com/repos/funcool/cats/statuses/f5b45e972891f0780739d371230906e74c03cf6f"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"niwinz","id":843689,"avatar_url":"https://avatars.githubusercontent.com/u/843689?v=3","gravatar_id":"","url":"https://api.github.com/users/niwinz","html_url":"https://github.com/niwinz","followers_url":"https://api.github.com/users/niwinz/followers","following_url":"https://api.github.com/users/niwinz/following{/other_user}","gists_url":"https://api.github.com/users/niwinz/gists{/gist_id}","starred_url":"https://api.github.com/users/niwinz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/niwinz/subscriptions","organizations_url":"https://api.github.com/users/niwinz/orgs","repos_url":"https://api.github.com/users/niwinz/repos","events_url":"https://api.github.com/users/niwinz/events{/privacy}","received_events_url":"https://api.github.com/users/niwinz/received_events","type":"User","site_admin":false},"comments":4,"review_comments":0,"commits":2,"additions":30,"deletions":0,"changed_files":2}}