{"action":"created","issue":{"url":"https://api.github.com/repos/elm-lang/error-message-catalog/issues/28","labels_url":"https://api.github.com/repos/elm-lang/error-message-catalog/issues/28/labels{/name}","comments_url":"https://api.github.com/repos/elm-lang/error-message-catalog/issues/28/comments","events_url":"https://api.github.com/repos/elm-lang/error-message-catalog/issues/28/events","html_url":"https://github.com/elm-lang/error-message-catalog/issues/28","id":97825470,"number":28,"title":"Mismatched type annotations hide quality error messages","user":{"login":"rtfeldman","id":1094080,"avatar_url":"https://avatars.githubusercontent.com/u/1094080?v=3","gravatar_id":"","url":"https://api.github.com/users/rtfeldman","html_url":"https://github.com/rtfeldman","followers_url":"https://api.github.com/users/rtfeldman/followers","following_url":"https://api.github.com/users/rtfeldman/following{/other_user}","gists_url":"https://api.github.com/users/rtfeldman/gists{/gist_id}","starred_url":"https://api.github.com/users/rtfeldman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rtfeldman/subscriptions","organizations_url":"https://api.github.com/users/rtfeldman/orgs","repos_url":"https://api.github.com/users/rtfeldman/repos","events_url":"https://api.github.com/users/rtfeldman/events{/privacy}","received_events_url":"https://api.github.com/users/rtfeldman/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/elm-lang/error-message-catalog/labels/types","name":"types","color":"207de5"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-07-28T23:52:05Z","updated_at":"2015-11-24T09:23:40Z","closed_at":null,"body":"I've made this mistake many times, but it only just occurred to me what the common thread was between the errors.\r\n\r\nSuppose I have this code:\r\n\r\n```elm\r\nbrokenFunction : a -> String\r\nbrokenFunction foo =\r\n    fourArgFunction 1 2 3\r\n\r\nfourArgFunction : Int -> Int -> Int -> Int -> String\r\nfourArgFunction one two three four =\r\n    toString (one + two + three + four)\r\n```\r\n\r\nThe error message I get is:\r\n\r\n```\r\nThe type annotation for `brokenFunction` does not match its definition.\r\n\r\n2| brokenFunction : a -> b -> String\r\n\r\nAs I infer the type of values flowing through your program, I see a conflict\r\nbetween these two types:\r\n\r\n    String\r\n\r\n    Int -> String\r\n```\r\n\r\nThe real problem, though, is that I've forgotten to pass a fourth argument to `fourArgumentFunction`.\r\n\r\nThis comes up a lot when I add an argument to a function, update some of its call sites, but then forget to update other call sites. I often end up confused because the error message mentions the caller but not the callee, so whenever I've made changes to both functions, the message leads me to presume one of my changes to the caller is the culprit, and I go down the wrong path.\r\n\r\nA more helpful error message could notice the pattern of \"caller was supposed to return `foo` but instead returned `a -> foo` as a result of a curried call to a function that takes `a` as its last argument\" and point that out to me, e.g.\r\n\r\n```\r\nThe type annotation for `brokenFunction` does not match its definition.\r\n\r\n2| brokenFunction : a -> b -> String\r\n\r\nAs I infer the type of values flowing through your program, I see a conflict\r\nbetween these two types:\r\n\r\n    String\r\n\r\n    Int -> String\r\n\r\nDid you mean to call `fourArgFunction` with only 3 arguments?\r\nIt needs 4 arguments to be fully applied.\r\n```"},"comment":{"url":"https://api.github.com/repos/elm-lang/error-message-catalog/issues/comments/159205611","html_url":"https://github.com/elm-lang/error-message-catalog/issues/28#issuecomment-159205611","issue_url":"https://api.github.com/repos/elm-lang/error-message-catalog/issues/28","id":159205611,"user":{"login":"kitofr","id":76820,"avatar_url":"https://avatars.githubusercontent.com/u/76820?v=3","gravatar_id":"","url":"https://api.github.com/users/kitofr","html_url":"https://github.com/kitofr","followers_url":"https://api.github.com/users/kitofr/followers","following_url":"https://api.github.com/users/kitofr/following{/other_user}","gists_url":"https://api.github.com/users/kitofr/gists{/gist_id}","starred_url":"https://api.github.com/users/kitofr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kitofr/subscriptions","organizations_url":"https://api.github.com/users/kitofr/orgs","repos_url":"https://api.github.com/users/kitofr/repos","events_url":"https://api.github.com/users/kitofr/events{/privacy}","received_events_url":"https://api.github.com/users/kitofr/received_events","type":"User","site_admin":false},"created_at":"2015-11-24T09:23:40Z","updated_at":"2015-11-24T09:23:40Z","body":"@evancz I sure can do!"}}