{"action":"created","issue":{"url":"https://api.github.com/repos/elm-lang/error-message-catalog/issues/23","labels_url":"https://api.github.com/repos/elm-lang/error-message-catalog/issues/23/labels{/name}","comments_url":"https://api.github.com/repos/elm-lang/error-message-catalog/issues/23/comments","events_url":"https://api.github.com/repos/elm-lang/error-message-catalog/issues/23/events","html_url":"https://github.com/elm-lang/error-message-catalog/issues/23","id":95370810,"number":23,"title":"Long records in error messages difficult to manually diff","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":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-07-16T07:37:04Z","updated_at":"2015-10-28T21:08:48Z","closed_at":"2015-10-28T08:42:58Z","body":"Consider this code:\r\n\r\n```elm\r\ntype alias Person =\r\n  {\r\n    firstName : String,\r\n    lastName : String,\r\n    \r\n    hairColor : String,\r\n    eyeColor : String,\r\n\r\n    address : String,\r\n    phoenNumber : String,\r\n    email : String,\r\n    \r\n    pets : Int\r\n  }\r\n\r\ngetFullName : Person -> String\r\ngetFullName person =\r\n  person.firstName ++ \" \" ++ person.lastName\r\n  \r\nfullName =\r\n  getFullName\r\n    {\r\n      firstName = \"Sam\",\r\n      lastName = \"Sample\",\r\n      \r\n      hairColor = \"Brown\",\r\n      eyeColor = \"Brown\",\r\n      \r\n      address = \"1337 Elite st\",\r\n      phoneNumber = \"867-5309\",\r\n      email = \"foo@bar.com\",\r\n      \r\n      pets = 2\r\n    }\r\n```\r\n\r\nIf you try to compile it, you get this type mismatch:\r\n\r\n```\r\nThe 1st argument to function `getFullName` has an unexpected type.\r\n\r\n21|   getFullName\r\n22|>    {\r\n23|>      firstName = \"Sam\",\r\n24|>      lastName = \"Sample\",\r\n25|>      \r\n26|>      hairColor = \"Brown\",\r\n27|>      eyeColor = \"Brown\",\r\n28|>      \r\n29|>      address = \"1337 Elite st\",\r\n30|>      phoneNumber = \"867-5309\",\r\n31|>      email = \"foo@bar.com\",\r\n32|>      \r\n33|>      pets = 2\r\n34|>    }\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    Person\r\n\r\n    { address : String\r\n    , email : String\r\n    , eyeColor : String\r\n    , firstName : String\r\n    , hairColor : String\r\n    , lastName : String\r\n    , pets : Int\r\n    , phoneNumber : String\r\n    }\r\n```\r\n\r\nThe underlying problem is a small typo: the definition of `Person` has the field listed as `phoenNumber` rather than `phoneNumber`. However, that is very difficult to deduce from this error message!\r\n\r\nIt would be really great if, when there's a type mismatch between two records, the compiler could diff the two records' fields and tell you what's different about them. In that case, this one could have been:\r\n\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    Person\r\n\r\n    { address : String\r\n    , email : String\r\n    , eyeColor : String\r\n    , firstName : String\r\n    , hairColor : String\r\n    , lastName : String\r\n    , pets : Int\r\n    , phoneNumber : String\r\n    }\r\n\r\nComparing the former to the latter...\r\n\r\n  The following fields were missing:\r\n\r\n    phoenNumber : String\r\n\r\n  The following fields were added:\r\n\r\n    phoneNumber : String\r\n```\r\n\r\nInstead of spending awhile hunting down the difference, this would have instantly directed me to the source of the problem.\r\n\r\nThis one would be a major time-saver for me, as I frequently work with records that have 10+ fields, and these errors don't seem to get significantly faster to debug with experience."},"comment":{"url":"https://api.github.com/repos/elm-lang/error-message-catalog/issues/comments/151990604","html_url":"https://github.com/elm-lang/error-message-catalog/issues/23#issuecomment-151990604","issue_url":"https://api.github.com/repos/elm-lang/error-message-catalog/issues/23","id":151990604,"user":{"login":"evancz","id":1658058,"avatar_url":"https://avatars.githubusercontent.com/u/1658058?v=3","gravatar_id":"","url":"https://api.github.com/users/evancz","html_url":"https://github.com/evancz","followers_url":"https://api.github.com/users/evancz/followers","following_url":"https://api.github.com/users/evancz/following{/other_user}","gists_url":"https://api.github.com/users/evancz/gists{/gist_id}","starred_url":"https://api.github.com/users/evancz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evancz/subscriptions","organizations_url":"https://api.github.com/users/evancz/orgs","repos_url":"https://api.github.com/users/evancz/repos","events_url":"https://api.github.com/users/evancz/events{/privacy}","received_events_url":"https://api.github.com/users/evancz/received_events","type":"User","site_admin":false},"created_at":"2015-10-28T21:08:48Z","updated_at":"2015-10-28T21:08:48Z","body":"Also, I hope I don't sound too harsh there! I just need some additional stuff, and there's no real way to know \"how to be great at github issues\" unless you do it wrong a lot. That's how I learned, and I'd say I still have a lot to learn!"}}