{"action":"created","comment":{"url":"https://api.github.com/repos/markhibberd/pirate/pulls/comments/26435028","id":26435028,"diff_hunk":"@@ -127,7 +127,10 @@ object Read extends shapeless.ProductTypeClassCompanion[Read] {\n     optionRead(s => Try(f(s)).toOption, expected)\n \n   def optionRead[A](f: String => Option[A], expected: String): Read[A] =\n-    string flatMap (s => f(s).cata(v => value(v), error(ReadErrorInvalidType(s, expected))))\n+    eitherRead(s => f(s).toRightDisjunction(expected))\n+\n+  def eitherRead[A](f: String => String \\/ A): Read[A] =\n+    string.flatMap(s => f(s).fold(e => error(ReadErrorInvalidType(s, e)), value(_)))","path":"src/main/scala/pirate/Read.scala","position":8,"original_position":8,"commit_id":"a6725154aa4e5c74adb738f5ba3490775d5d561b","original_commit_id":"a6725154aa4e5c74adb738f5ba3490775d5d561b","user":{"login":"charleso","id":31059,"avatar_url":"https://avatars.githubusercontent.com/u/31059?v=3","gravatar_id":"","url":"https://api.github.com/users/charleso","html_url":"https://github.com/charleso","followers_url":"https://api.github.com/users/charleso/followers","following_url":"https://api.github.com/users/charleso/following{/other_user}","gists_url":"https://api.github.com/users/charleso/gists{/gist_id}","starred_url":"https://api.github.com/users/charleso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/charleso/subscriptions","organizations_url":"https://api.github.com/users/charleso/orgs","repos_url":"https://api.github.com/users/charleso/repos","events_url":"https://api.github.com/users/charleso/events{/privacy}","received_events_url":"https://api.github.com/users/charleso/received_events","type":"User","site_admin":false},"body":"Not convinced this is the correct error type, but `ReadErrorMessage` ignores the token.","created_at":"2015-03-14T03:52:23Z","updated_at":"2015-03-14T03:52:23Z","html_url":"https://github.com/markhibberd/pirate/pull/42#discussion_r26435028","pull_request_url":"https://api.github.com/repos/markhibberd/pirate/pulls/42","_links":{"self":{"href":"https://api.github.com/repos/markhibberd/pirate/pulls/comments/26435028"},"html":{"href":"https://github.com/markhibberd/pirate/pull/42#discussion_r26435028"},"pull_request":{"href":"https://api.github.com/repos/markhibberd/pirate/pulls/42"}}},"pull_request":{"url":"https://api.github.com/repos/markhibberd/pirate/pulls/42","id":31177758,"html_url":"https://github.com/markhibberd/pirate/pull/42","diff_url":"https://github.com/markhibberd/pirate/pull/42.diff","patch_url":"https://github.com/markhibberd/pirate/pull/42.patch","issue_url":"https://api.github.com/repos/markhibberd/pirate/issues/42","number":42,"state":"open","locked":false,"title":"Introduce eitherRead combinator","user":{"login":"charleso","id":31059,"avatar_url":"https://avatars.githubusercontent.com/u/31059?v=3","gravatar_id":"","url":"https://api.github.com/users/charleso","html_url":"https://github.com/charleso","followers_url":"https://api.github.com/users/charleso/followers","following_url":"https://api.github.com/users/charleso/following{/other_user}","gists_url":"https://api.github.com/users/charleso/gists{/gist_id}","starred_url":"https://api.github.com/users/charleso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/charleso/subscriptions","organizations_url":"https://api.github.com/users/charleso/orgs","repos_url":"https://api.github.com/users/charleso/repos","events_url":"https://api.github.com/users/charleso/events{/privacy}","received_events_url":"https://api.github.com/users/charleso/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-03-14T03:51:49Z","updated_at":"2015-03-14T03:52:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c77878235107b17ebdd4a66ed07f5bde125750a7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/markhibberd/pirate/pulls/42/commits","review_comments_url":"https://api.github.com/repos/markhibberd/pirate/pulls/42/comments","review_comment_url":"https://api.github.com/repos/markhibberd/pirate/pulls/comments{/number}","comments_url":"https://api.github.com/repos/markhibberd/pirate/issues/42/comments","statuses_url":"https://api.github.com/repos/markhibberd/pirate/statuses/a6725154aa4e5c74adb738f5ba3490775d5d561b","head":{"label":"markhibberd:topic/read-either","ref":"topic/read-either","sha":"a6725154aa4e5c74adb738f5ba3490775d5d561b","user":{"login":"markhibberd","id":22832,"avatar_url":"https://avatars.githubusercontent.com/u/22832?v=3","gravatar_id":"","url":"https://api.github.com/users/markhibberd","html_url":"https://github.com/markhibberd","followers_url":"https://api.github.com/users/markhibberd/followers","following_url":"https://api.github.com/users/markhibberd/following{/other_user}","gists_url":"https://api.github.com/users/markhibberd/gists{/gist_id}","starred_url":"https://api.github.com/users/markhibberd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markhibberd/subscriptions","organizations_url":"https://api.github.com/users/markhibberd/orgs","repos_url":"https://api.github.com/users/markhibberd/repos","events_url":"https://api.github.com/users/markhibberd/events{/privacy}","received_events_url":"https://api.github.com/users/markhibberd/received_events","type":"User","site_admin":false},"repo":{"id":1102396,"name":"pirate","full_name":"markhibberd/pirate","owner":{"login":"markhibberd","id":22832,"avatar_url":"https://avatars.githubusercontent.com/u/22832?v=3","gravatar_id":"","url":"https://api.github.com/users/markhibberd","html_url":"https://github.com/markhibberd","followers_url":"https://api.github.com/users/markhibberd/followers","following_url":"https://api.github.com/users/markhibberd/following{/other_user}","gists_url":"https://api.github.com/users/markhibberd/gists{/gist_id}","starred_url":"https://api.github.com/users/markhibberd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markhibberd/subscriptions","organizations_url":"https://api.github.com/users/markhibberd/orgs","repos_url":"https://api.github.com/users/markhibberd/repos","events_url":"https://api.github.com/users/markhibberd/events{/privacy}","received_events_url":"https://api.github.com/users/markhibberd/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/markhibberd/pirate","description":"Non-horrible command line parsing.","fork":false,"url":"https://api.github.com/repos/markhibberd/pirate","forks_url":"https://api.github.com/repos/markhibberd/pirate/forks","keys_url":"https://api.github.com/repos/markhibberd/pirate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/markhibberd/pirate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/markhibberd/pirate/teams","hooks_url":"https://api.github.com/repos/markhibberd/pirate/hooks","issue_events_url":"https://api.github.com/repos/markhibberd/pirate/issues/events{/number}","events_url":"https://api.github.com/repos/markhibberd/pirate/events","assignees_url":"https://api.github.com/repos/markhibberd/pirate/assignees{/user}","branches_url":"https://api.github.com/repos/markhibberd/pirate/branches{/branch}","tags_url":"https://api.github.com/repos/markhibberd/pirate/tags","blobs_url":"https://api.github.com/repos/markhibberd/pirate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/markhibberd/pirate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/markhibberd/pirate/git/refs{/sha}","trees_url":"https://api.github.com/repos/markhibberd/pirate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/markhibberd/pirate/statuses/{sha}","languages_url":"https://api.github.com/repos/markhibberd/pirate/languages","stargazers_url":"https://api.github.com/repos/markhibberd/pirate/stargazers","contributors_url":"https://api.github.com/repos/markhibberd/pirate/contributors","subscribers_url":"https://api.github.com/repos/markhibberd/pirate/subscribers","subscription_url":"https://api.github.com/repos/markhibberd/pirate/subscription","commits_url":"https://api.github.com/repos/markhibberd/pirate/commits{/sha}","git_commits_url":"https://api.github.com/repos/markhibberd/pirate/git/commits{/sha}","comments_url":"https://api.github.com/repos/markhibberd/pirate/comments{/number}","issue_comment_url":"https://api.github.com/repos/markhibberd/pirate/issues/comments{/number}","contents_url":"https://api.github.com/repos/markhibberd/pirate/contents/{+path}","compare_url":"https://api.github.com/repos/markhibberd/pirate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/markhibberd/pirate/merges","archive_url":"https://api.github.com/repos/markhibberd/pirate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/markhibberd/pirate/downloads","issues_url":"https://api.github.com/repos/markhibberd/pirate/issues{/number}","pulls_url":"https://api.github.com/repos/markhibberd/pirate/pulls{/number}","milestones_url":"https://api.github.com/repos/markhibberd/pirate/milestones{/number}","notifications_url":"https://api.github.com/repos/markhibberd/pirate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/markhibberd/pirate/labels{/name}","releases_url":"https://api.github.com/repos/markhibberd/pirate/releases{/id}","created_at":"2010-11-22T13:49:35Z","updated_at":"2015-03-13T03:36:10Z","pushed_at":"2015-03-14T03:51:15Z","git_url":"git://github.com/markhibberd/pirate.git","ssh_url":"git@github.com:markhibberd/pirate.git","clone_url":"https://github.com/markhibberd/pirate.git","svn_url":"https://github.com/markhibberd/pirate","homepage":"https://github.com/markhibberd/pirate","size":42335,"stargazers_count":13,"watchers_count":13,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":7,"forks":4,"open_issues":7,"watchers":13,"default_branch":"master"}},"base":{"label":"markhibberd:master","ref":"master","sha":"a5c24d7365fc7710aa02a938c6aa35cc74825bb9","user":{"login":"markhibberd","id":22832,"avatar_url":"https://avatars.githubusercontent.com/u/22832?v=3","gravatar_id":"","url":"https://api.github.com/users/markhibberd","html_url":"https://github.com/markhibberd","followers_url":"https://api.github.com/users/markhibberd/followers","following_url":"https://api.github.com/users/markhibberd/following{/other_user}","gists_url":"https://api.github.com/users/markhibberd/gists{/gist_id}","starred_url":"https://api.github.com/users/markhibberd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markhibberd/subscriptions","organizations_url":"https://api.github.com/users/markhibberd/orgs","repos_url":"https://api.github.com/users/markhibberd/repos","events_url":"https://api.github.com/users/markhibberd/events{/privacy}","received_events_url":"https://api.github.com/users/markhibberd/received_events","type":"User","site_admin":false},"repo":{"id":1102396,"name":"pirate","full_name":"markhibberd/pirate","owner":{"login":"markhibberd","id":22832,"avatar_url":"https://avatars.githubusercontent.com/u/22832?v=3","gravatar_id":"","url":"https://api.github.com/users/markhibberd","html_url":"https://github.com/markhibberd","followers_url":"https://api.github.com/users/markhibberd/followers","following_url":"https://api.github.com/users/markhibberd/following{/other_user}","gists_url":"https://api.github.com/users/markhibberd/gists{/gist_id}","starred_url":"https://api.github.com/users/markhibberd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markhibberd/subscriptions","organizations_url":"https://api.github.com/users/markhibberd/orgs","repos_url":"https://api.github.com/users/markhibberd/repos","events_url":"https://api.github.com/users/markhibberd/events{/privacy}","received_events_url":"https://api.github.com/users/markhibberd/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/markhibberd/pirate","description":"Non-horrible command line parsing.","fork":false,"url":"https://api.github.com/repos/markhibberd/pirate","forks_url":"https://api.github.com/repos/markhibberd/pirate/forks","keys_url":"https://api.github.com/repos/markhibberd/pirate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/markhibberd/pirate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/markhibberd/pirate/teams","hooks_url":"https://api.github.com/repos/markhibberd/pirate/hooks","issue_events_url":"https://api.github.com/repos/markhibberd/pirate/issues/events{/number}","events_url":"https://api.github.com/repos/markhibberd/pirate/events","assignees_url":"https://api.github.com/repos/markhibberd/pirate/assignees{/user}","branches_url":"https://api.github.com/repos/markhibberd/pirate/branches{/branch}","tags_url":"https://api.github.com/repos/markhibberd/pirate/tags","blobs_url":"https://api.github.com/repos/markhibberd/pirate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/markhibberd/pirate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/markhibberd/pirate/git/refs{/sha}","trees_url":"https://api.github.com/repos/markhibberd/pirate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/markhibberd/pirate/statuses/{sha}","languages_url":"https://api.github.com/repos/markhibberd/pirate/languages","stargazers_url":"https://api.github.com/repos/markhibberd/pirate/stargazers","contributors_url":"https://api.github.com/repos/markhibberd/pirate/contributors","subscribers_url":"https://api.github.com/repos/markhibberd/pirate/subscribers","subscription_url":"https://api.github.com/repos/markhibberd/pirate/subscription","commits_url":"https://api.github.com/repos/markhibberd/pirate/commits{/sha}","git_commits_url":"https://api.github.com/repos/markhibberd/pirate/git/commits{/sha}","comments_url":"https://api.github.com/repos/markhibberd/pirate/comments{/number}","issue_comment_url":"https://api.github.com/repos/markhibberd/pirate/issues/comments{/number}","contents_url":"https://api.github.com/repos/markhibberd/pirate/contents/{+path}","compare_url":"https://api.github.com/repos/markhibberd/pirate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/markhibberd/pirate/merges","archive_url":"https://api.github.com/repos/markhibberd/pirate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/markhibberd/pirate/downloads","issues_url":"https://api.github.com/repos/markhibberd/pirate/issues{/number}","pulls_url":"https://api.github.com/repos/markhibberd/pirate/pulls{/number}","milestones_url":"https://api.github.com/repos/markhibberd/pirate/milestones{/number}","notifications_url":"https://api.github.com/repos/markhibberd/pirate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/markhibberd/pirate/labels{/name}","releases_url":"https://api.github.com/repos/markhibberd/pirate/releases{/id}","created_at":"2010-11-22T13:49:35Z","updated_at":"2015-03-13T03:36:10Z","pushed_at":"2015-03-14T03:51:15Z","git_url":"git://github.com/markhibberd/pirate.git","ssh_url":"git@github.com:markhibberd/pirate.git","clone_url":"https://github.com/markhibberd/pirate.git","svn_url":"https://github.com/markhibberd/pirate","homepage":"https://github.com/markhibberd/pirate","size":42335,"stargazers_count":13,"watchers_count":13,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":7,"forks":4,"open_issues":7,"watchers":13,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/markhibberd/pirate/pulls/42"},"html":{"href":"https://github.com/markhibberd/pirate/pull/42"},"issue":{"href":"https://api.github.com/repos/markhibberd/pirate/issues/42"},"comments":{"href":"https://api.github.com/repos/markhibberd/pirate/issues/42/comments"},"review_comments":{"href":"https://api.github.com/repos/markhibberd/pirate/pulls/42/comments"},"review_comment":{"href":"https://api.github.com/repos/markhibberd/pirate/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/markhibberd/pirate/pulls/42/commits"},"statuses":{"href":"https://api.github.com/repos/markhibberd/pirate/statuses/a6725154aa4e5c74adb738f5ba3490775d5d561b"}}}}