{"action":"created","comment":{"url":"https://api.github.com/repos/plaid/sanctuary-def/pulls/comments/59124814","id":59124814,"diff_hunk":"@@ -678,41 +681,22 @@\n   };\n \n   //  commonTypes :: ([[Type]], Boolean) -> [Type]\n-  var commonTypes = function(typeses, loose) {\n-    var types = chain(typeses, id);\n-    if (isEmpty(types)) return [];\n-\n-    var $1s, $2s, candidates, idx, t;\n-    if (types[0].type === 'UNARY') {\n-      $1s = {};\n-      for (idx = 0; idx < types.length; idx += 1) {\n-        t = types[idx];\n-        if (t.$1.type !== 'UNKNOWN') $1s[t.$1.name] = t.$1;\n-      }\n-      candidates =\n-      map(or(map(keys($1s), function(k) { return $1s[k]; }), [Unknown]),\n-          UnaryType.from(types[0]));\n-    } else if (types[0].type === 'BINARY') {\n-      $1s = {};\n-      $2s = {};\n-      for (idx = 0; idx < types.length; idx += 1) {\n-        t = types[idx];\n-        if (t.$1.type !== 'UNKNOWN') $1s[t.$1.name] = t.$1;\n-        if (t.$2.type !== 'UNKNOWN') $2s[t.$2.name] = t.$2;\n-      }\n-      candidates = BinaryType.xprod(\n-        types[0],\n-        or(map(keys($1s), function(k) { return $1s[k]; }), [Unknown]),\n-        or(map(keys($2s), function(k) { return $2s[k]; }), [Unknown])\n-      );\n-    } else {\n-      candidates = types;\n-    }\n-\n-    return filter(candidates, function(t1) {\n-      return all(typeses, function(types) {\n-        return any(types, function(t2) {\n-          return equalTypes(t1, t2, loose);\n+  //\n+  //  [[String, RegexFlags], [String, RegexFlags]] ---> [String, RegexFlags]\n+  //\n+  //  [[Boolean], [Boolean], [Boolean], [Number]] ---> []\n+  //\n+  //  [[Array ???], [Array String], [Array ???]] ---> [Array String]\n+  //\n+  //  [[Either String ???], [Either ??? Number]] ---> [Either String Number]\n+  var commonTypes = function($typeses, loose) {\n+    return filter($typeses[0], function($t) {\n+      return all($typeses, function(types) {\n+        return any(types, function(t) {\n+          var equal = equalTypes($t, t, loose);\n+          if (equal && '$1' in $t && $t.$1.type === 'UNKNOWN') $t.$1 = t.$1;\n+          if (equal && '$2' in $t && $t.$2.type === 'UNKNOWN') $t.$2 = t.$2;","path":"index.js","position":102,"original_position":102,"commit_id":"b5fa3488640bca5299de5822ace050c49480b4aa","original_commit_id":"b5fa3488640bca5299de5822ace050c49480b4aa","user":{"login":"davidchambers","id":210406,"avatar_url":"https://avatars.githubusercontent.com/u/210406?v=3","gravatar_id":"","url":"https://api.github.com/users/davidchambers","html_url":"https://github.com/davidchambers","followers_url":"https://api.github.com/users/davidchambers/followers","following_url":"https://api.github.com/users/davidchambers/following{/other_user}","gists_url":"https://api.github.com/users/davidchambers/gists{/gist_id}","starred_url":"https://api.github.com/users/davidchambers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidchambers/subscriptions","organizations_url":"https://api.github.com/users/davidchambers/orgs","repos_url":"https://api.github.com/users/davidchambers/repos","events_url":"https://api.github.com/users/davidchambers/events{/privacy}","received_events_url":"https://api.github.com/users/davidchambers/received_events","type":"User","site_admin":false},"body":"Thanks to the mutation above we determine the type of `[Left('XXX'), Right(42)]` to be `Array (Either String Number)` rather than `Array (Either String ???)`.\r\n\r\n:warning: Note that we're mutating `$typeses` in the process. I use `$` to draw attention to the mutation of an argument!\r\n","created_at":"2016-04-10T01:00:51Z","updated_at":"2016-04-10T01:00:51Z","html_url":"https://github.com/plaid/sanctuary-def/pull/51#discussion_r59124814","pull_request_url":"https://api.github.com/repos/plaid/sanctuary-def/pulls/51","_links":{"self":{"href":"https://api.github.com/repos/plaid/sanctuary-def/pulls/comments/59124814"},"html":{"href":"https://github.com/plaid/sanctuary-def/pull/51#discussion_r59124814"},"pull_request":{"href":"https://api.github.com/repos/plaid/sanctuary-def/pulls/51"}}},"pull_request":{"url":"https://api.github.com/repos/plaid/sanctuary-def/pulls/51","id":65897314,"html_url":"https://github.com/plaid/sanctuary-def/pull/51","diff_url":"https://github.com/plaid/sanctuary-def/pull/51.diff","patch_url":"https://github.com/plaid/sanctuary-def/pull/51.patch","issue_url":"https://api.github.com/repos/plaid/sanctuary-def/issues/51","number":51,"state":"open","locked":false,"title":"fix type error in commonTypes","user":{"login":"davidchambers","id":210406,"avatar_url":"https://avatars.githubusercontent.com/u/210406?v=3","gravatar_id":"","url":"https://api.github.com/users/davidchambers","html_url":"https://github.com/davidchambers","followers_url":"https://api.github.com/users/davidchambers/followers","following_url":"https://api.github.com/users/davidchambers/following{/other_user}","gists_url":"https://api.github.com/users/davidchambers/gists{/gist_id}","starred_url":"https://api.github.com/users/davidchambers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidchambers/subscriptions","organizations_url":"https://api.github.com/users/davidchambers/orgs","repos_url":"https://api.github.com/users/davidchambers/repos","events_url":"https://api.github.com/users/davidchambers/events{/privacy}","received_events_url":"https://api.github.com/users/davidchambers/received_events","type":"User","site_admin":false},"body":"Commit message:\r\n\r\n> We currently assume that `commonTypes` is always applied to a list of lists of types of the same arity. If the first type is binary, for example, we incorrectly assume that all subsequent types also have `$1` and `$2` fields.\r\n","created_at":"2016-04-10T00:52:01Z","updated_at":"2016-04-10T01:00:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b535d689eeeb1797188326d7db184e2ced25ab17","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/plaid/sanctuary-def/pulls/51/commits","review_comments_url":"https://api.github.com/repos/plaid/sanctuary-def/pulls/51/comments","review_comment_url":"https://api.github.com/repos/plaid/sanctuary-def/pulls/comments{/number}","comments_url":"https://api.github.com/repos/plaid/sanctuary-def/issues/51/comments","statuses_url":"https://api.github.com/repos/plaid/sanctuary-def/statuses/b5fa3488640bca5299de5822ace050c49480b4aa","head":{"label":"plaid:dc-common-types","ref":"dc-common-types","sha":"b5fa3488640bca5299de5822ace050c49480b4aa","user":{"login":"plaid","id":3579888,"avatar_url":"https://avatars.githubusercontent.com/u/3579888?v=3","gravatar_id":"","url":"https://api.github.com/users/plaid","html_url":"https://github.com/plaid","followers_url":"https://api.github.com/users/plaid/followers","following_url":"https://api.github.com/users/plaid/following{/other_user}","gists_url":"https://api.github.com/users/plaid/gists{/gist_id}","starred_url":"https://api.github.com/users/plaid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plaid/subscriptions","organizations_url":"https://api.github.com/users/plaid/orgs","repos_url":"https://api.github.com/users/plaid/repos","events_url":"https://api.github.com/users/plaid/events{/privacy}","received_events_url":"https://api.github.com/users/plaid/received_events","type":"Organization","site_admin":false},"repo":{"id":43796926,"name":"sanctuary-def","full_name":"plaid/sanctuary-def","owner":{"login":"plaid","id":3579888,"avatar_url":"https://avatars.githubusercontent.com/u/3579888?v=3","gravatar_id":"","url":"https://api.github.com/users/plaid","html_url":"https://github.com/plaid","followers_url":"https://api.github.com/users/plaid/followers","following_url":"https://api.github.com/users/plaid/following{/other_user}","gists_url":"https://api.github.com/users/plaid/gists{/gist_id}","starred_url":"https://api.github.com/users/plaid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plaid/subscriptions","organizations_url":"https://api.github.com/users/plaid/orgs","repos_url":"https://api.github.com/users/plaid/repos","events_url":"https://api.github.com/users/plaid/events{/privacy}","received_events_url":"https://api.github.com/users/plaid/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/plaid/sanctuary-def","description":":guardsman: Run-time type system for JavaScript","fork":false,"url":"https://api.github.com/repos/plaid/sanctuary-def","forks_url":"https://api.github.com/repos/plaid/sanctuary-def/forks","keys_url":"https://api.github.com/repos/plaid/sanctuary-def/keys{/key_id}","collaborators_url":"https://api.github.com/repos/plaid/sanctuary-def/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/plaid/sanctuary-def/teams","hooks_url":"https://api.github.com/repos/plaid/sanctuary-def/hooks","issue_events_url":"https://api.github.com/repos/plaid/sanctuary-def/issues/events{/number}","events_url":"https://api.github.com/repos/plaid/sanctuary-def/events","assignees_url":"https://api.github.com/repos/plaid/sanctuary-def/assignees{/user}","branches_url":"https://api.github.com/repos/plaid/sanctuary-def/branches{/branch}","tags_url":"https://api.github.com/repos/plaid/sanctuary-def/tags","blobs_url":"https://api.github.com/repos/plaid/sanctuary-def/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/plaid/sanctuary-def/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/plaid/sanctuary-def/git/refs{/sha}","trees_url":"https://api.github.com/repos/plaid/sanctuary-def/git/trees{/sha}","statuses_url":"https://api.github.com/repos/plaid/sanctuary-def/statuses/{sha}","languages_url":"https://api.github.com/repos/plaid/sanctuary-def/languages","stargazers_url":"https://api.github.com/repos/plaid/sanctuary-def/stargazers","contributors_url":"https://api.github.com/repos/plaid/sanctuary-def/contributors","subscribers_url":"https://api.github.com/repos/plaid/sanctuary-def/subscribers","subscription_url":"https://api.github.com/repos/plaid/sanctuary-def/subscription","commits_url":"https://api.github.com/repos/plaid/sanctuary-def/commits{/sha}","git_commits_url":"https://api.github.com/repos/plaid/sanctuary-def/git/commits{/sha}","comments_url":"https://api.github.com/repos/plaid/sanctuary-def/comments{/number}","issue_comment_url":"https://api.github.com/repos/plaid/sanctuary-def/issues/comments{/number}","contents_url":"https://api.github.com/repos/plaid/sanctuary-def/contents/{+path}","compare_url":"https://api.github.com/repos/plaid/sanctuary-def/compare/{base}...{head}","merges_url":"https://api.github.com/repos/plaid/sanctuary-def/merges","archive_url":"https://api.github.com/repos/plaid/sanctuary-def/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/plaid/sanctuary-def/downloads","issues_url":"https://api.github.com/repos/plaid/sanctuary-def/issues{/number}","pulls_url":"https://api.github.com/repos/plaid/sanctuary-def/pulls{/number}","milestones_url":"https://api.github.com/repos/plaid/sanctuary-def/milestones{/number}","notifications_url":"https://api.github.com/repos/plaid/sanctuary-def/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/plaid/sanctuary-def/labels{/name}","releases_url":"https://api.github.com/repos/plaid/sanctuary-def/releases{/id}","deployments_url":"https://api.github.com/repos/plaid/sanctuary-def/deployments","created_at":"2015-10-07T05:29:16Z","updated_at":"2016-03-30T20:29:58Z","pushed_at":"2016-04-10T00:52:01Z","git_url":"git://github.com/plaid/sanctuary-def.git","ssh_url":"git@github.com:plaid/sanctuary-def.git","clone_url":"https://github.com/plaid/sanctuary-def.git","svn_url":"https://github.com/plaid/sanctuary-def","homepage":"","size":100,"stargazers_count":36,"watchers_count":36,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":9,"forks":3,"open_issues":9,"watchers":36,"default_branch":"master"}},"base":{"label":"plaid:master","ref":"master","sha":"b5a66a165543b528e7db3de439f5642729544265","user":{"login":"plaid","id":3579888,"avatar_url":"https://avatars.githubusercontent.com/u/3579888?v=3","gravatar_id":"","url":"https://api.github.com/users/plaid","html_url":"https://github.com/plaid","followers_url":"https://api.github.com/users/plaid/followers","following_url":"https://api.github.com/users/plaid/following{/other_user}","gists_url":"https://api.github.com/users/plaid/gists{/gist_id}","starred_url":"https://api.github.com/users/plaid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plaid/subscriptions","organizations_url":"https://api.github.com/users/plaid/orgs","repos_url":"https://api.github.com/users/plaid/repos","events_url":"https://api.github.com/users/plaid/events{/privacy}","received_events_url":"https://api.github.com/users/plaid/received_events","type":"Organization","site_admin":false},"repo":{"id":43796926,"name":"sanctuary-def","full_name":"plaid/sanctuary-def","owner":{"login":"plaid","id":3579888,"avatar_url":"https://avatars.githubusercontent.com/u/3579888?v=3","gravatar_id":"","url":"https://api.github.com/users/plaid","html_url":"https://github.com/plaid","followers_url":"https://api.github.com/users/plaid/followers","following_url":"https://api.github.com/users/plaid/following{/other_user}","gists_url":"https://api.github.com/users/plaid/gists{/gist_id}","starred_url":"https://api.github.com/users/plaid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plaid/subscriptions","organizations_url":"https://api.github.com/users/plaid/orgs","repos_url":"https://api.github.com/users/plaid/repos","events_url":"https://api.github.com/users/plaid/events{/privacy}","received_events_url":"https://api.github.com/users/plaid/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/plaid/sanctuary-def","description":":guardsman: Run-time type system for JavaScript","fork":false,"url":"https://api.github.com/repos/plaid/sanctuary-def","forks_url":"https://api.github.com/repos/plaid/sanctuary-def/forks","keys_url":"https://api.github.com/repos/plaid/sanctuary-def/keys{/key_id}","collaborators_url":"https://api.github.com/repos/plaid/sanctuary-def/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/plaid/sanctuary-def/teams","hooks_url":"https://api.github.com/repos/plaid/sanctuary-def/hooks","issue_events_url":"https://api.github.com/repos/plaid/sanctuary-def/issues/events{/number}","events_url":"https://api.github.com/repos/plaid/sanctuary-def/events","assignees_url":"https://api.github.com/repos/plaid/sanctuary-def/assignees{/user}","branches_url":"https://api.github.com/repos/plaid/sanctuary-def/branches{/branch}","tags_url":"https://api.github.com/repos/plaid/sanctuary-def/tags","blobs_url":"https://api.github.com/repos/plaid/sanctuary-def/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/plaid/sanctuary-def/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/plaid/sanctuary-def/git/refs{/sha}","trees_url":"https://api.github.com/repos/plaid/sanctuary-def/git/trees{/sha}","statuses_url":"https://api.github.com/repos/plaid/sanctuary-def/statuses/{sha}","languages_url":"https://api.github.com/repos/plaid/sanctuary-def/languages","stargazers_url":"https://api.github.com/repos/plaid/sanctuary-def/stargazers","contributors_url":"https://api.github.com/repos/plaid/sanctuary-def/contributors","subscribers_url":"https://api.github.com/repos/plaid/sanctuary-def/subscribers","subscription_url":"https://api.github.com/repos/plaid/sanctuary-def/subscription","commits_url":"https://api.github.com/repos/plaid/sanctuary-def/commits{/sha}","git_commits_url":"https://api.github.com/repos/plaid/sanctuary-def/git/commits{/sha}","comments_url":"https://api.github.com/repos/plaid/sanctuary-def/comments{/number}","issue_comment_url":"https://api.github.com/repos/plaid/sanctuary-def/issues/comments{/number}","contents_url":"https://api.github.com/repos/plaid/sanctuary-def/contents/{+path}","compare_url":"https://api.github.com/repos/plaid/sanctuary-def/compare/{base}...{head}","merges_url":"https://api.github.com/repos/plaid/sanctuary-def/merges","archive_url":"https://api.github.com/repos/plaid/sanctuary-def/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/plaid/sanctuary-def/downloads","issues_url":"https://api.github.com/repos/plaid/sanctuary-def/issues{/number}","pulls_url":"https://api.github.com/repos/plaid/sanctuary-def/pulls{/number}","milestones_url":"https://api.github.com/repos/plaid/sanctuary-def/milestones{/number}","notifications_url":"https://api.github.com/repos/plaid/sanctuary-def/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/plaid/sanctuary-def/labels{/name}","releases_url":"https://api.github.com/repos/plaid/sanctuary-def/releases{/id}","deployments_url":"https://api.github.com/repos/plaid/sanctuary-def/deployments","created_at":"2015-10-07T05:29:16Z","updated_at":"2016-03-30T20:29:58Z","pushed_at":"2016-04-10T00:52:01Z","git_url":"git://github.com/plaid/sanctuary-def.git","ssh_url":"git@github.com:plaid/sanctuary-def.git","clone_url":"https://github.com/plaid/sanctuary-def.git","svn_url":"https://github.com/plaid/sanctuary-def","homepage":"","size":100,"stargazers_count":36,"watchers_count":36,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":9,"forks":3,"open_issues":9,"watchers":36,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/plaid/sanctuary-def/pulls/51"},"html":{"href":"https://github.com/plaid/sanctuary-def/pull/51"},"issue":{"href":"https://api.github.com/repos/plaid/sanctuary-def/issues/51"},"comments":{"href":"https://api.github.com/repos/plaid/sanctuary-def/issues/51/comments"},"review_comments":{"href":"https://api.github.com/repos/plaid/sanctuary-def/pulls/51/comments"},"review_comment":{"href":"https://api.github.com/repos/plaid/sanctuary-def/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/plaid/sanctuary-def/pulls/51/commits"},"statuses":{"href":"https://api.github.com/repos/plaid/sanctuary-def/statuses/b5fa3488640bca5299de5822ace050c49480b4aa"}}}}