{"action":"created","comment":{"url":"https://api.github.com/repos/purescript/purescript/pulls/comments/94535640","pull_request_review_id":15061798,"id":94535640,"diff_hunk":"@@ -170,49 +170,58 @@ type TypeData = M.Map (Qualified Ident) (Type, NameKind, NameVisibility)\n \n type UntypedData = [(Ident, Type)]\n \n+-- | This function breaks a binding group down into two sets of declarations:\n+-- those which contain type annotations, and those which don't.\n+-- This function also generates fresh unification variables for the types of\n+-- declarations without type annotations, returned in the 'UntypedData' structure.\n typeDictionaryForBindingGroup\n-  :: (MonadState CheckState m)\n+  :: (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)\n   => Maybe ModuleName\n   -> [(Ident, Expr)]\n   -> m ([(Ident, Expr)], [(Ident, (Expr, Type, Bool))], TypeData, UntypedData)\n typeDictionaryForBindingGroup moduleName vals = do\n-  let\n-    -- Map each declaration to a name/value pair, with an optional type, if the declaration is typed\n-    es = map isTyped vals\n-    -- Filter the typed and untyped declarations\n-    untyped = lefts es\n-    typed = rights es\n-    -- Make a map of names to typed declarations\n-    typedDict = map (\\(ident, (_, ty, _)) -> (ident, ty)) typed\n-\n-  -- Create fresh unification variables for the types of untyped declarations\n-  untypedNames <- replicateM (length untyped) freshType\n-\n-  let\n+    -- Filter the typed and untyped declarations and make a map of names to typed declarations.\n+    -- Replace type wildcards here so that the resulting dictionary of types contains the\n+    -- fully expanded types.\n+    let (untyped, typed) = partitionEithers (map isTyped vals)\n+    (typedDict, typed') <- fmap unzip . for typed $ \\(ident, (expr, ty, checkType)) -> do\n+      ty' <- introduceSkolemScope <=< replaceAllTypeSynonyms <=< replaceTypeWildcards $ ty","path":"src/Language/PureScript/TypeChecker/Types.hs","position":57,"original_position":57,"commit_id":"3de31019e8a0fc8e439dfa5621a2889506295823","original_commit_id":"3de31019e8a0fc8e439dfa5621a2889506295823","user":{"login":"kRITZCREEK","id":6189397,"avatar_url":"https://avatars.githubusercontent.com/u/6189397?v=3","gravatar_id":"","url":"https://api.github.com/users/kRITZCREEK","html_url":"https://github.com/kRITZCREEK","followers_url":"https://api.github.com/users/kRITZCREEK/followers","following_url":"https://api.github.com/users/kRITZCREEK/following{/other_user}","gists_url":"https://api.github.com/users/kRITZCREEK/gists{/gist_id}","starred_url":"https://api.github.com/users/kRITZCREEK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kRITZCREEK/subscriptions","organizations_url":"https://api.github.com/users/kRITZCREEK/orgs","repos_url":"https://api.github.com/users/kRITZCREEK/repos","events_url":"https://api.github.com/users/kRITZCREEK/events{/privacy}","received_events_url":"https://api.github.com/users/kRITZCREEK/received_events","type":"User","site_admin":false},"body":"It would be nice if we could track whether this already happened with a phantom type. During the thesis it appeared like a magic incantation that \"does things\" when you get a certain error.","created_at":"2017-01-04T06:44:14Z","updated_at":"2017-01-04T06:45:13Z","html_url":"https://github.com/purescript/purescript/pull/2535#discussion_r94535640","pull_request_url":"https://api.github.com/repos/purescript/purescript/pulls/2535","_links":{"self":{"href":"https://api.github.com/repos/purescript/purescript/pulls/comments/94535640"},"html":{"href":"https://github.com/purescript/purescript/pull/2535#discussion_r94535640"},"pull_request":{"href":"https://api.github.com/repos/purescript/purescript/pulls/2535"}}},"pull_request":{"url":"https://api.github.com/repos/purescript/purescript/pulls/2535","id":100058559,"html_url":"https://github.com/purescript/purescript/pull/2535","diff_url":"https://github.com/purescript/purescript/pull/2535.diff","patch_url":"https://github.com/purescript/purescript/pull/2535.patch","issue_url":"https://api.github.com/repos/purescript/purescript/issues/2535","number":2535,"state":"open","locked":false,"title":"Replace type wildcards earlier","user":{"login":"paf31","id":630306,"avatar_url":"https://avatars.githubusercontent.com/u/630306?v=3","gravatar_id":"","url":"https://api.github.com/users/paf31","html_url":"https://github.com/paf31","followers_url":"https://api.github.com/users/paf31/followers","following_url":"https://api.github.com/users/paf31/following{/other_user}","gists_url":"https://api.github.com/users/paf31/gists{/gist_id}","starred_url":"https://api.github.com/users/paf31/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paf31/subscriptions","organizations_url":"https://api.github.com/users/paf31/orgs","repos_url":"https://api.github.com/users/paf31/repos","events_url":"https://api.github.com/users/paf31/events{/privacy}","received_events_url":"https://api.github.com/users/paf31/received_events","type":"User","site_admin":false},"body":"Fixes #2534\r\n\r\nThis looks like a bigger change than it is. The key is to move the call to `replaceTypeWildcards` from `checkTypedBindingGroupElement` into `typeDictionaryForBindingGroup`. This function is called earlier and returns the map from function names in a binding group to their types. This forces the necessary unification to happen on the expanded type instead of the original type, which includes the wildcard.\r\n\r\nI also did a bit of tidying to make the formatting in this module more consistent.","created_at":"2017-01-04T03:42:59Z","updated_at":"2017-01-04T06:45:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ba97730f6a4cb96c99ca8019b87648e5535c0643","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/purescript/purescript/pulls/2535/commits","review_comments_url":"https://api.github.com/repos/purescript/purescript/pulls/2535/comments","review_comment_url":"https://api.github.com/repos/purescript/purescript/pulls/comments{/number}","comments_url":"https://api.github.com/repos/purescript/purescript/issues/2535/comments","statuses_url":"https://api.github.com/repos/purescript/purescript/statuses/3de31019e8a0fc8e439dfa5621a2889506295823","head":{"label":"purescript:phil/2534","ref":"phil/2534","sha":"3de31019e8a0fc8e439dfa5621a2889506295823","user":{"login":"purescript","id":6556677,"avatar_url":"https://avatars.githubusercontent.com/u/6556677?v=3","gravatar_id":"","url":"https://api.github.com/users/purescript","html_url":"https://github.com/purescript","followers_url":"https://api.github.com/users/purescript/followers","following_url":"https://api.github.com/users/purescript/following{/other_user}","gists_url":"https://api.github.com/users/purescript/gists{/gist_id}","starred_url":"https://api.github.com/users/purescript/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/purescript/subscriptions","organizations_url":"https://api.github.com/users/purescript/orgs","repos_url":"https://api.github.com/users/purescript/repos","events_url":"https://api.github.com/users/purescript/events{/privacy}","received_events_url":"https://api.github.com/users/purescript/received_events","type":"Organization","site_admin":false},"repo":{"id":13206906,"name":"purescript","full_name":"purescript/purescript","owner":{"login":"purescript","id":6556677,"avatar_url":"https://avatars.githubusercontent.com/u/6556677?v=3","gravatar_id":"","url":"https://api.github.com/users/purescript","html_url":"https://github.com/purescript","followers_url":"https://api.github.com/users/purescript/followers","following_url":"https://api.github.com/users/purescript/following{/other_user}","gists_url":"https://api.github.com/users/purescript/gists{/gist_id}","starred_url":"https://api.github.com/users/purescript/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/purescript/subscriptions","organizations_url":"https://api.github.com/users/purescript/orgs","repos_url":"https://api.github.com/users/purescript/repos","events_url":"https://api.github.com/users/purescript/events{/privacy}","received_events_url":"https://api.github.com/users/purescript/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/purescript/purescript","description":"A small strongly typed language that compiles to Javascript","fork":false,"url":"https://api.github.com/repos/purescript/purescript","forks_url":"https://api.github.com/repos/purescript/purescript/forks","keys_url":"https://api.github.com/repos/purescript/purescript/keys{/key_id}","collaborators_url":"https://api.github.com/repos/purescript/purescript/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/purescript/purescript/teams","hooks_url":"https://api.github.com/repos/purescript/purescript/hooks","issue_events_url":"https://api.github.com/repos/purescript/purescript/issues/events{/number}","events_url":"https://api.github.com/repos/purescript/purescript/events","assignees_url":"https://api.github.com/repos/purescript/purescript/assignees{/user}","branches_url":"https://api.github.com/repos/purescript/purescript/branches{/branch}","tags_url":"https://api.github.com/repos/purescript/purescript/tags","blobs_url":"https://api.github.com/repos/purescript/purescript/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/purescript/purescript/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/purescript/purescript/git/refs{/sha}","trees_url":"https://api.github.com/repos/purescript/purescript/git/trees{/sha}","statuses_url":"https://api.github.com/repos/purescript/purescript/statuses/{sha}","languages_url":"https://api.github.com/repos/purescript/purescript/languages","stargazers_url":"https://api.github.com/repos/purescript/purescript/stargazers","contributors_url":"https://api.github.com/repos/purescript/purescript/contributors","subscribers_url":"https://api.github.com/repos/purescript/purescript/subscribers","subscription_url":"https://api.github.com/repos/purescript/purescript/subscription","commits_url":"https://api.github.com/repos/purescript/purescript/commits{/sha}","git_commits_url":"https://api.github.com/repos/purescript/purescript/git/commits{/sha}","comments_url":"https://api.github.com/repos/purescript/purescript/comments{/number}","issue_comment_url":"https://api.github.com/repos/purescript/purescript/issues/comments{/number}","contents_url":"https://api.github.com/repos/purescript/purescript/contents/{+path}","compare_url":"https://api.github.com/repos/purescript/purescript/compare/{base}...{head}","merges_url":"https://api.github.com/repos/purescript/purescript/merges","archive_url":"https://api.github.com/repos/purescript/purescript/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/purescript/purescript/downloads","issues_url":"https://api.github.com/repos/purescript/purescript/issues{/number}","pulls_url":"https://api.github.com/repos/purescript/purescript/pulls{/number}","milestones_url":"https://api.github.com/repos/purescript/purescript/milestones{/number}","notifications_url":"https://api.github.com/repos/purescript/purescript/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/purescript/purescript/labels{/name}","releases_url":"https://api.github.com/repos/purescript/purescript/releases{/id}","deployments_url":"https://api.github.com/repos/purescript/purescript/deployments","created_at":"2013-09-30T05:29:23Z","updated_at":"2017-01-04T06:21:20Z","pushed_at":"2017-01-04T04:21:32Z","git_url":"git://github.com/purescript/purescript.git","ssh_url":"git@github.com:purescript/purescript.git","clone_url":"https://github.com/purescript/purescript.git","svn_url":"https://github.com/purescript/purescript","homepage":"http://purescript.org","size":8090,"stargazers_count":3161,"watchers_count":3161,"language":"Haskell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":262,"mirror_url":null,"open_issues_count":150,"forks":262,"open_issues":150,"watchers":3161,"default_branch":"master"}},"base":{"label":"purescript:master","ref":"master","sha":"086bbe68ebd75ccb1acab71c88096eebd31de538","user":{"login":"purescript","id":6556677,"avatar_url":"https://avatars.githubusercontent.com/u/6556677?v=3","gravatar_id":"","url":"https://api.github.com/users/purescript","html_url":"https://github.com/purescript","followers_url":"https://api.github.com/users/purescript/followers","following_url":"https://api.github.com/users/purescript/following{/other_user}","gists_url":"https://api.github.com/users/purescript/gists{/gist_id}","starred_url":"https://api.github.com/users/purescript/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/purescript/subscriptions","organizations_url":"https://api.github.com/users/purescript/orgs","repos_url":"https://api.github.com/users/purescript/repos","events_url":"https://api.github.com/users/purescript/events{/privacy}","received_events_url":"https://api.github.com/users/purescript/received_events","type":"Organization","site_admin":false},"repo":{"id":13206906,"name":"purescript","full_name":"purescript/purescript","owner":{"login":"purescript","id":6556677,"avatar_url":"https://avatars.githubusercontent.com/u/6556677?v=3","gravatar_id":"","url":"https://api.github.com/users/purescript","html_url":"https://github.com/purescript","followers_url":"https://api.github.com/users/purescript/followers","following_url":"https://api.github.com/users/purescript/following{/other_user}","gists_url":"https://api.github.com/users/purescript/gists{/gist_id}","starred_url":"https://api.github.com/users/purescript/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/purescript/subscriptions","organizations_url":"https://api.github.com/users/purescript/orgs","repos_url":"https://api.github.com/users/purescript/repos","events_url":"https://api.github.com/users/purescript/events{/privacy}","received_events_url":"https://api.github.com/users/purescript/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/purescript/purescript","description":"A small strongly typed language that compiles to Javascript","fork":false,"url":"https://api.github.com/repos/purescript/purescript","forks_url":"https://api.github.com/repos/purescript/purescript/forks","keys_url":"https://api.github.com/repos/purescript/purescript/keys{/key_id}","collaborators_url":"https://api.github.com/repos/purescript/purescript/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/purescript/purescript/teams","hooks_url":"https://api.github.com/repos/purescript/purescript/hooks","issue_events_url":"https://api.github.com/repos/purescript/purescript/issues/events{/number}","events_url":"https://api.github.com/repos/purescript/purescript/events","assignees_url":"https://api.github.com/repos/purescript/purescript/assignees{/user}","branches_url":"https://api.github.com/repos/purescript/purescript/branches{/branch}","tags_url":"https://api.github.com/repos/purescript/purescript/tags","blobs_url":"https://api.github.com/repos/purescript/purescript/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/purescript/purescript/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/purescript/purescript/git/refs{/sha}","trees_url":"https://api.github.com/repos/purescript/purescript/git/trees{/sha}","statuses_url":"https://api.github.com/repos/purescript/purescript/statuses/{sha}","languages_url":"https://api.github.com/repos/purescript/purescript/languages","stargazers_url":"https://api.github.com/repos/purescript/purescript/stargazers","contributors_url":"https://api.github.com/repos/purescript/purescript/contributors","subscribers_url":"https://api.github.com/repos/purescript/purescript/subscribers","subscription_url":"https://api.github.com/repos/purescript/purescript/subscription","commits_url":"https://api.github.com/repos/purescript/purescript/commits{/sha}","git_commits_url":"https://api.github.com/repos/purescript/purescript/git/commits{/sha}","comments_url":"https://api.github.com/repos/purescript/purescript/comments{/number}","issue_comment_url":"https://api.github.com/repos/purescript/purescript/issues/comments{/number}","contents_url":"https://api.github.com/repos/purescript/purescript/contents/{+path}","compare_url":"https://api.github.com/repos/purescript/purescript/compare/{base}...{head}","merges_url":"https://api.github.com/repos/purescript/purescript/merges","archive_url":"https://api.github.com/repos/purescript/purescript/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/purescript/purescript/downloads","issues_url":"https://api.github.com/repos/purescript/purescript/issues{/number}","pulls_url":"https://api.github.com/repos/purescript/purescript/pulls{/number}","milestones_url":"https://api.github.com/repos/purescript/purescript/milestones{/number}","notifications_url":"https://api.github.com/repos/purescript/purescript/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/purescript/purescript/labels{/name}","releases_url":"https://api.github.com/repos/purescript/purescript/releases{/id}","deployments_url":"https://api.github.com/repos/purescript/purescript/deployments","created_at":"2013-09-30T05:29:23Z","updated_at":"2017-01-04T06:21:20Z","pushed_at":"2017-01-04T04:21:32Z","git_url":"git://github.com/purescript/purescript.git","ssh_url":"git@github.com:purescript/purescript.git","clone_url":"https://github.com/purescript/purescript.git","svn_url":"https://github.com/purescript/purescript","homepage":"http://purescript.org","size":8090,"stargazers_count":3161,"watchers_count":3161,"language":"Haskell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":262,"mirror_url":null,"open_issues_count":150,"forks":262,"open_issues":150,"watchers":3161,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/purescript/purescript/pulls/2535"},"html":{"href":"https://github.com/purescript/purescript/pull/2535"},"issue":{"href":"https://api.github.com/repos/purescript/purescript/issues/2535"},"comments":{"href":"https://api.github.com/repos/purescript/purescript/issues/2535/comments"},"review_comments":{"href":"https://api.github.com/repos/purescript/purescript/pulls/2535/comments"},"review_comment":{"href":"https://api.github.com/repos/purescript/purescript/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/purescript/purescript/pulls/2535/commits"},"statuses":{"href":"https://api.github.com/repos/purescript/purescript/statuses/3de31019e8a0fc8e439dfa5621a2889506295823"}}}}
{"actor":{"display_login":"kRITZCREEK"}}