{"action":"created","comment":{"url":"https://api.github.com/repos/gcanti/fp-ts/pulls/comments/128458492","pull_request_review_id":51138256,"id":128458492,"diff_hunk":"@@ -82,4 +83,8 @@ export function empty<A>(): Task<A> {\n   return never as Task<A>\n }\n \n+export function fromPromise<L, A>(f: Lazy<Promise<A>>, onrejected: (reason: any) => L): Task<Either<L, A>> {\n+  return new Task(() => f().then(a => right<L, A>(a), reason => left<L, A>(onrejected(reason))))\n+}\n+","path":"src/Task.ts","position":15,"original_position":15,"commit_id":"86f29162463285bf0e015bd2ca17dace6d43686b","original_commit_id":"86f29162463285bf0e015bd2ca17dace6d43686b","user":{"login":"OliverJAsh","id":921609,"avatar_url":"https://avatars2.githubusercontent.com/u/921609?v=4","gravatar_id":"","url":"https://api.github.com/users/OliverJAsh","html_url":"https://github.com/OliverJAsh","followers_url":"https://api.github.com/users/OliverJAsh/followers","following_url":"https://api.github.com/users/OliverJAsh/following{/other_user}","gists_url":"https://api.github.com/users/OliverJAsh/gists{/gist_id}","starred_url":"https://api.github.com/users/OliverJAsh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OliverJAsh/subscriptions","organizations_url":"https://api.github.com/users/OliverJAsh/orgs","repos_url":"https://api.github.com/users/OliverJAsh/repos","events_url":"https://api.github.com/users/OliverJAsh/events{/privacy}","received_events_url":"https://api.github.com/users/OliverJAsh/received_events","type":"User","site_admin":false},"body":"It does feel slightly inconsistent to have `Task.fromPromise` and `either.tryCatch`, which are async and sync versions of the same idea, but with different naming. 🤔 ","created_at":"2017-07-20T08:51:13Z","updated_at":"2017-07-20T08:51:44Z","html_url":"https://github.com/gcanti/fp-ts/pull/163#discussion_r128458492","pull_request_url":"https://api.github.com/repos/gcanti/fp-ts/pulls/163","_links":{"self":{"href":"https://api.github.com/repos/gcanti/fp-ts/pulls/comments/128458492"},"html":{"href":"https://github.com/gcanti/fp-ts/pull/163#discussion_r128458492"},"pull_request":{"href":"https://api.github.com/repos/gcanti/fp-ts/pulls/163"}}},"pull_request":{"url":"https://api.github.com/repos/gcanti/fp-ts/pulls/163","id":131482304,"html_url":"https://github.com/gcanti/fp-ts/pull/163","diff_url":"https://github.com/gcanti/fp-ts/pull/163.diff","patch_url":"https://github.com/gcanti/fp-ts/pull/163.patch","issue_url":"https://api.github.com/repos/gcanti/fp-ts/issues/163","number":163,"state":"open","locked":false,"title":"add Task.fromPromise, closes #159","user":{"login":"gcanti","id":878912,"avatar_url":"https://avatars1.githubusercontent.com/u/878912?v=4","gravatar_id":"","url":"https://api.github.com/users/gcanti","html_url":"https://github.com/gcanti","followers_url":"https://api.github.com/users/gcanti/followers","following_url":"https://api.github.com/users/gcanti/following{/other_user}","gists_url":"https://api.github.com/users/gcanti/gists{/gist_id}","starred_url":"https://api.github.com/users/gcanti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gcanti/subscriptions","organizations_url":"https://api.github.com/users/gcanti/orgs","repos_url":"https://api.github.com/users/gcanti/repos","events_url":"https://api.github.com/users/gcanti/events{/privacy}","received_events_url":"https://api.github.com/users/gcanti/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-07-20T07:00:07Z","updated_at":"2017-07-20T08:51:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5449b795f44846ffadaefc8d7479da2c579f3620","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/gcanti/fp-ts/pulls/163/commits","review_comments_url":"https://api.github.com/repos/gcanti/fp-ts/pulls/163/comments","review_comment_url":"https://api.github.com/repos/gcanti/fp-ts/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gcanti/fp-ts/issues/163/comments","statuses_url":"https://api.github.com/repos/gcanti/fp-ts/statuses/86f29162463285bf0e015bd2ca17dace6d43686b","head":{"label":"gcanti:159","ref":"159","sha":"86f29162463285bf0e015bd2ca17dace6d43686b","user":{"login":"gcanti","id":878912,"avatar_url":"https://avatars1.githubusercontent.com/u/878912?v=4","gravatar_id":"","url":"https://api.github.com/users/gcanti","html_url":"https://github.com/gcanti","followers_url":"https://api.github.com/users/gcanti/followers","following_url":"https://api.github.com/users/gcanti/following{/other_user}","gists_url":"https://api.github.com/users/gcanti/gists{/gist_id}","starred_url":"https://api.github.com/users/gcanti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gcanti/subscriptions","organizations_url":"https://api.github.com/users/gcanti/orgs","repos_url":"https://api.github.com/users/gcanti/repos","events_url":"https://api.github.com/users/gcanti/events{/privacy}","received_events_url":"https://api.github.com/users/gcanti/received_events","type":"User","site_admin":false},"repo":{"id":80039696,"name":"fp-ts","full_name":"gcanti/fp-ts","owner":{"login":"gcanti","id":878912,"avatar_url":"https://avatars1.githubusercontent.com/u/878912?v=4","gravatar_id":"","url":"https://api.github.com/users/gcanti","html_url":"https://github.com/gcanti","followers_url":"https://api.github.com/users/gcanti/followers","following_url":"https://api.github.com/users/gcanti/following{/other_user}","gists_url":"https://api.github.com/users/gcanti/gists{/gist_id}","starred_url":"https://api.github.com/users/gcanti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gcanti/subscriptions","organizations_url":"https://api.github.com/users/gcanti/orgs","repos_url":"https://api.github.com/users/gcanti/repos","events_url":"https://api.github.com/users/gcanti/events{/privacy}","received_events_url":"https://api.github.com/users/gcanti/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gcanti/fp-ts","description":"Functional programming in TypeScript","fork":false,"url":"https://api.github.com/repos/gcanti/fp-ts","forks_url":"https://api.github.com/repos/gcanti/fp-ts/forks","keys_url":"https://api.github.com/repos/gcanti/fp-ts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gcanti/fp-ts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gcanti/fp-ts/teams","hooks_url":"https://api.github.com/repos/gcanti/fp-ts/hooks","issue_events_url":"https://api.github.com/repos/gcanti/fp-ts/issues/events{/number}","events_url":"https://api.github.com/repos/gcanti/fp-ts/events","assignees_url":"https://api.github.com/repos/gcanti/fp-ts/assignees{/user}","branches_url":"https://api.github.com/repos/gcanti/fp-ts/branches{/branch}","tags_url":"https://api.github.com/repos/gcanti/fp-ts/tags","blobs_url":"https://api.github.com/repos/gcanti/fp-ts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gcanti/fp-ts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gcanti/fp-ts/git/refs{/sha}","trees_url":"https://api.github.com/repos/gcanti/fp-ts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gcanti/fp-ts/statuses/{sha}","languages_url":"https://api.github.com/repos/gcanti/fp-ts/languages","stargazers_url":"https://api.github.com/repos/gcanti/fp-ts/stargazers","contributors_url":"https://api.github.com/repos/gcanti/fp-ts/contributors","subscribers_url":"https://api.github.com/repos/gcanti/fp-ts/subscribers","subscription_url":"https://api.github.com/repos/gcanti/fp-ts/subscription","commits_url":"https://api.github.com/repos/gcanti/fp-ts/commits{/sha}","git_commits_url":"https://api.github.com/repos/gcanti/fp-ts/git/commits{/sha}","comments_url":"https://api.github.com/repos/gcanti/fp-ts/comments{/number}","issue_comment_url":"https://api.github.com/repos/gcanti/fp-ts/issues/comments{/number}","contents_url":"https://api.github.com/repos/gcanti/fp-ts/contents/{+path}","compare_url":"https://api.github.com/repos/gcanti/fp-ts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gcanti/fp-ts/merges","archive_url":"https://api.github.com/repos/gcanti/fp-ts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gcanti/fp-ts/downloads","issues_url":"https://api.github.com/repos/gcanti/fp-ts/issues{/number}","pulls_url":"https://api.github.com/repos/gcanti/fp-ts/pulls{/number}","milestones_url":"https://api.github.com/repos/gcanti/fp-ts/milestones{/number}","notifications_url":"https://api.github.com/repos/gcanti/fp-ts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gcanti/fp-ts/labels{/name}","releases_url":"https://api.github.com/repos/gcanti/fp-ts/releases{/id}","deployments_url":"https://api.github.com/repos/gcanti/fp-ts/deployments","created_at":"2017-01-25T17:44:09Z","updated_at":"2017-07-19T03:04:43Z","pushed_at":"2017-07-20T07:00:07Z","git_url":"git://github.com/gcanti/fp-ts.git","ssh_url":"git@github.com:gcanti/fp-ts.git","clone_url":"https://github.com/gcanti/fp-ts.git","svn_url":"https://github.com/gcanti/fp-ts","homepage":"","size":377,"stargazers_count":215,"watchers_count":215,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":15,"mirror_url":null,"open_issues_count":18,"forks":15,"open_issues":18,"watchers":215,"default_branch":"master"}},"base":{"label":"gcanti:master","ref":"master","sha":"92bc1ed617597a4ba8246d859d97a470be31b1ad","user":{"login":"gcanti","id":878912,"avatar_url":"https://avatars1.githubusercontent.com/u/878912?v=4","gravatar_id":"","url":"https://api.github.com/users/gcanti","html_url":"https://github.com/gcanti","followers_url":"https://api.github.com/users/gcanti/followers","following_url":"https://api.github.com/users/gcanti/following{/other_user}","gists_url":"https://api.github.com/users/gcanti/gists{/gist_id}","starred_url":"https://api.github.com/users/gcanti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gcanti/subscriptions","organizations_url":"https://api.github.com/users/gcanti/orgs","repos_url":"https://api.github.com/users/gcanti/repos","events_url":"https://api.github.com/users/gcanti/events{/privacy}","received_events_url":"https://api.github.com/users/gcanti/received_events","type":"User","site_admin":false},"repo":{"id":80039696,"name":"fp-ts","full_name":"gcanti/fp-ts","owner":{"login":"gcanti","id":878912,"avatar_url":"https://avatars1.githubusercontent.com/u/878912?v=4","gravatar_id":"","url":"https://api.github.com/users/gcanti","html_url":"https://github.com/gcanti","followers_url":"https://api.github.com/users/gcanti/followers","following_url":"https://api.github.com/users/gcanti/following{/other_user}","gists_url":"https://api.github.com/users/gcanti/gists{/gist_id}","starred_url":"https://api.github.com/users/gcanti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gcanti/subscriptions","organizations_url":"https://api.github.com/users/gcanti/orgs","repos_url":"https://api.github.com/users/gcanti/repos","events_url":"https://api.github.com/users/gcanti/events{/privacy}","received_events_url":"https://api.github.com/users/gcanti/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gcanti/fp-ts","description":"Functional programming in TypeScript","fork":false,"url":"https://api.github.com/repos/gcanti/fp-ts","forks_url":"https://api.github.com/repos/gcanti/fp-ts/forks","keys_url":"https://api.github.com/repos/gcanti/fp-ts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gcanti/fp-ts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gcanti/fp-ts/teams","hooks_url":"https://api.github.com/repos/gcanti/fp-ts/hooks","issue_events_url":"https://api.github.com/repos/gcanti/fp-ts/issues/events{/number}","events_url":"https://api.github.com/repos/gcanti/fp-ts/events","assignees_url":"https://api.github.com/repos/gcanti/fp-ts/assignees{/user}","branches_url":"https://api.github.com/repos/gcanti/fp-ts/branches{/branch}","tags_url":"https://api.github.com/repos/gcanti/fp-ts/tags","blobs_url":"https://api.github.com/repos/gcanti/fp-ts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gcanti/fp-ts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gcanti/fp-ts/git/refs{/sha}","trees_url":"https://api.github.com/repos/gcanti/fp-ts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gcanti/fp-ts/statuses/{sha}","languages_url":"https://api.github.com/repos/gcanti/fp-ts/languages","stargazers_url":"https://api.github.com/repos/gcanti/fp-ts/stargazers","contributors_url":"https://api.github.com/repos/gcanti/fp-ts/contributors","subscribers_url":"https://api.github.com/repos/gcanti/fp-ts/subscribers","subscription_url":"https://api.github.com/repos/gcanti/fp-ts/subscription","commits_url":"https://api.github.com/repos/gcanti/fp-ts/commits{/sha}","git_commits_url":"https://api.github.com/repos/gcanti/fp-ts/git/commits{/sha}","comments_url":"https://api.github.com/repos/gcanti/fp-ts/comments{/number}","issue_comment_url":"https://api.github.com/repos/gcanti/fp-ts/issues/comments{/number}","contents_url":"https://api.github.com/repos/gcanti/fp-ts/contents/{+path}","compare_url":"https://api.github.com/repos/gcanti/fp-ts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gcanti/fp-ts/merges","archive_url":"https://api.github.com/repos/gcanti/fp-ts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gcanti/fp-ts/downloads","issues_url":"https://api.github.com/repos/gcanti/fp-ts/issues{/number}","pulls_url":"https://api.github.com/repos/gcanti/fp-ts/pulls{/number}","milestones_url":"https://api.github.com/repos/gcanti/fp-ts/milestones{/number}","notifications_url":"https://api.github.com/repos/gcanti/fp-ts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gcanti/fp-ts/labels{/name}","releases_url":"https://api.github.com/repos/gcanti/fp-ts/releases{/id}","deployments_url":"https://api.github.com/repos/gcanti/fp-ts/deployments","created_at":"2017-01-25T17:44:09Z","updated_at":"2017-07-19T03:04:43Z","pushed_at":"2017-07-20T07:00:07Z","git_url":"git://github.com/gcanti/fp-ts.git","ssh_url":"git@github.com:gcanti/fp-ts.git","clone_url":"https://github.com/gcanti/fp-ts.git","svn_url":"https://github.com/gcanti/fp-ts","homepage":"","size":377,"stargazers_count":215,"watchers_count":215,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":15,"mirror_url":null,"open_issues_count":18,"forks":15,"open_issues":18,"watchers":215,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gcanti/fp-ts/pulls/163"},"html":{"href":"https://github.com/gcanti/fp-ts/pull/163"},"issue":{"href":"https://api.github.com/repos/gcanti/fp-ts/issues/163"},"comments":{"href":"https://api.github.com/repos/gcanti/fp-ts/issues/163/comments"},"review_comments":{"href":"https://api.github.com/repos/gcanti/fp-ts/pulls/163/comments"},"review_comment":{"href":"https://api.github.com/repos/gcanti/fp-ts/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gcanti/fp-ts/pulls/163/commits"},"statuses":{"href":"https://api.github.com/repos/gcanti/fp-ts/statuses/86f29162463285bf0e015bd2ca17dace6d43686b"}}}}
{"actor":{"display_login":"OliverJAsh"}}