{"action":"created","issue":{"url":"https://api.github.com/repos/elm-lang/elm-compiler/issues/1086","labels_url":"https://api.github.com/repos/elm-lang/elm-compiler/issues/1086/labels{/name}","comments_url":"https://api.github.com/repos/elm-lang/elm-compiler/issues/1086/comments","events_url":"https://api.github.com/repos/elm-lang/elm-compiler/issues/1086/events","html_url":"https://github.com/elm-lang/elm-compiler/issues/1086","id":110290810,"number":1086,"title":"\"Cannot read property 'ctor' of undefined\" on 0.16-alpha","user":{"login":"pdamoc","id":878106,"avatar_url":"https://avatars.githubusercontent.com/u/878106?v=3","gravatar_id":"","url":"https://api.github.com/users/pdamoc","html_url":"https://github.com/pdamoc","followers_url":"https://api.github.com/users/pdamoc/followers","following_url":"https://api.github.com/users/pdamoc/following{/other_user}","gists_url":"https://api.github.com/users/pdamoc/gists{/gist_id}","starred_url":"https://api.github.com/users/pdamoc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pdamoc/subscriptions","organizations_url":"https://api.github.com/users/pdamoc/orgs","repos_url":"https://api.github.com/users/pdamoc/repos","events_url":"https://api.github.com/users/pdamoc/events{/privacy}","received_events_url":"https://api.github.com/users/pdamoc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/elm-lang/elm-compiler/milestones/7","html_url":"https://github.com/elm-lang/elm-compiler/milestones/0.16","labels_url":"https://api.github.com/repos/elm-lang/elm-compiler/milestones/7/labels","id":1335844,"number":7,"title":"0.16","description":"","creator":{"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},"open_issues":2,"closed_issues":2,"state":"open","created_at":"2015-10-03T02:09:23Z","updated_at":"2015-10-08T06:22:14Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2015-10-07T18:44:53Z","updated_at":"2015-10-08T07:12:21Z","closed_at":null,"body":"The following code produces a `Cannot read property 'ctor' of undefined`\r\n\r\n```elm\r\nimport Graphics.Element exposing (show) \r\n\r\ntype AType = First     (() -> Bool)\r\n               | Second    (() -> Bool) String String\r\n\r\ngetSecond : a -> a -> AType\r\ngetSecond a b = Second (\\_ -> a == b) (toString a) (toString b)\r\n\r\ntoName : AType -> String\r\ntoName a =\r\n    let \r\n        name = case a of\r\n                 First _ -> \"True\"\r\n                 Second _ a b    -> a ++ \" == \" ++ b\r\n    in \r\n        name \r\n\r\nmain = show <| toName <| getSecond  1 1\r\n```\r\n\r\nIf I get rid of the let, the error disappears:\r\n```elm\r\nimport Graphics.Element exposing (show) \r\n\r\ntype AType = First     (() -> Bool)\r\n               | Second    (() -> Bool) String String\r\n\r\ngetSecond : a -> a -> AType\r\ngetSecond a b = Second (\\_ -> a == b) (toString a) (toString b)\r\n\r\ntoName : AType -> String\r\ntoName a =\r\n    case a of\r\n        First _ -> \"True\"\r\n        Second _ a b    -> a ++ \" == \" ++ b\r\n\r\nmain = show <| toName <| getSecond  1 1\r\n```\r\n\r\nAdding a quote to variable `a` as in `a'` also gets rid of the error \r\n```elm\r\nimport Graphics.Element exposing (show) \r\n\r\ntype AType = First     (() -> Bool)\r\n               | Second    (() -> Bool) String String\r\n\r\ngetSecond : a -> a -> AType\r\ngetSecond a b = Second (\\_ -> a == b) (toString a) (toString b)\r\n\r\ntoName : AType -> String\r\ntoName a =\r\n    let \r\n        name = case a of\r\n                 First _ -> \"True\"\r\n                 Second _ a' b    -> a' ++ \" == \" ++ b\r\n    in \r\n        name \r\n\r\nmain = show <| toName <| getSecond  1 1\r\n```\r\n\r\nIf only one case remains, the error becomes `Cannot read property '_1' of undefined`\r\n```elm\r\nimport Graphics.Element exposing (show) \r\n\r\ntype AType = Second    (() -> Bool) String String\r\n\r\ngetSecond : a -> a -> AType\r\ngetSecond a b = Second (\\_ -> a == b) (toString a) (toString b)\r\n\r\ntoName : AType -> String\r\ntoName a =\r\n    let \r\n        name = case a of\r\n                 Second _ a b    -> a ++ \" == \" ++ b\r\n    in \r\n        name \r\n\r\nmain = show <| toName <| getSecond  1 1\r\n```"},"comment":{"url":"https://api.github.com/repos/elm-lang/elm-compiler/issues/comments/146440401","html_url":"https://github.com/elm-lang/elm-compiler/issues/1086#issuecomment-146440401","issue_url":"https://api.github.com/repos/elm-lang/elm-compiler/issues/1086","id":146440401,"user":{"login":"pdamoc","id":878106,"avatar_url":"https://avatars.githubusercontent.com/u/878106?v=3","gravatar_id":"","url":"https://api.github.com/users/pdamoc","html_url":"https://github.com/pdamoc","followers_url":"https://api.github.com/users/pdamoc/followers","following_url":"https://api.github.com/users/pdamoc/following{/other_user}","gists_url":"https://api.github.com/users/pdamoc/gists{/gist_id}","starred_url":"https://api.github.com/users/pdamoc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pdamoc/subscriptions","organizations_url":"https://api.github.com/users/pdamoc/orgs","repos_url":"https://api.github.com/users/pdamoc/repos","events_url":"https://api.github.com/users/pdamoc/events{/privacy}","received_events_url":"https://api.github.com/users/pdamoc/received_events","type":"User","site_admin":false},"created_at":"2015-10-08T07:12:20Z","updated_at":"2015-10-08T07:12:20Z","body":"Wouldn't make more sense to aim towards the future (ES2015) and provide support for older browsers via something like BabelJS? "}}