{"action":"created","issue":{"url":"https://api.github.com/repos/purescript/purescript/issues/824","labels_url":"https://api.github.com/repos/purescript/purescript/issues/824/labels{/name}","comments_url":"https://api.github.com/repos/purescript/purescript/issues/824/comments","events_url":"https://api.github.com/repos/purescript/purescript/issues/824/events","html_url":"https://github.com/purescript/purescript/issues/824","id":55192640,"number":824,"title":"Variable named 'undefined' disappears in generated code","user":{"login":"philopon","id":483915,"avatar_url":"https://avatars.githubusercontent.com/u/483915?v=3","gravatar_id":"","url":"https://api.github.com/users/philopon","html_url":"https://github.com/philopon","followers_url":"https://api.github.com/users/philopon/followers","following_url":"https://api.github.com/users/philopon/following{/other_user}","gists_url":"https://api.github.com/users/philopon/gists{/gist_id}","starred_url":"https://api.github.com/users/philopon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philopon/subscriptions","organizations_url":"https://api.github.com/users/philopon/orgs","repos_url":"https://api.github.com/users/philopon/repos","events_url":"https://api.github.com/users/philopon/events{/privacy}","received_events_url":"https://api.github.com/users/philopon/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/purescript/purescript/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/purescript/purescript/labels/codegen","name":"codegen","color":"fbca04"}],"state":"closed","locked":false,"assignee":{"login":"garyb","id":693642,"avatar_url":"https://avatars.githubusercontent.com/u/693642?v=3","gravatar_id":"","url":"https://api.github.com/users/garyb","html_url":"https://github.com/garyb","followers_url":"https://api.github.com/users/garyb/followers","following_url":"https://api.github.com/users/garyb/following{/other_user}","gists_url":"https://api.github.com/users/garyb/gists{/gist_id}","starred_url":"https://api.github.com/users/garyb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garyb/subscriptions","organizations_url":"https://api.github.com/users/garyb/orgs","repos_url":"https://api.github.com/users/garyb/repos","events_url":"https://api.github.com/users/garyb/events{/privacy}","received_events_url":"https://api.github.com/users/garyb/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/purescript/purescript/milestones/11","html_url":"https://github.com/purescript/purescript/milestones/0.8.0","labels_url":"https://api.github.com/repos/purescript/purescript/milestones/11/labels","id":1073621,"number":11,"title":"0.8.0","description":"Focus areas:\r\n\r\n- Bug fixes\r\n- Performance\r\n- Improving error messages\r\n\r\nEverything else is being bumped to 0.9.","creator":{"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},"open_issues":28,"closed_issues":128,"state":"open","created_at":"2015-04-18T23:12:02Z","updated_at":"2015-11-15T02:43:57Z","due_on":null,"closed_at":null},"comments":10,"created_at":"2015-01-22T18:49:39Z","updated_at":"2015-11-15T02:51:43Z","closed_at":"2015-11-15T02:43:57Z","body":"Hi!\r\n\r\nthis Reproducing code\r\n\r\n```.purs\r\nmodule Test where\r\n\r\nimport Control.Monad.Eff\r\n\r\nforeign import valid     :: forall a. a\r\n\r\nforeign import undefined :: forall a. a\r\nforeign import null      :: forall a. a\r\n\r\ntestValid :: Eff _ _\r\ntestValid = return valid\r\n\r\ntestUndef :: Eff _ _\r\ntestUndef = return undefined\r\n\r\ntestNull :: Eff _ _\r\ntestNull = return null\r\n```\r\n\r\ngenerates\r\n\r\n```.js\r\n...\r\n    var testValid = Prelude[\"return\"](Control_Monad_Eff.monadEff)(valid);\r\n    var testUndef = Prelude[\"return\"](Control_Monad_Eff.monadEff)();\r\n    var testNull = Prelude[\"return\"](Control_Monad_Eff.monadEff)($$null);\r\n...\r\n```\r\n\r\nI think case of `undefined` and `null` isn't prospective behavior. I think it should generate\r\n\r\n```.js\r\n    var testUndef = Prelude[\"return\"](Control_Monad_Eff.monadEff)(undefined);\r\n    var testNull = Prelude[\"return\"](Control_Monad_Eff.monadEff)(null);\r\n```\r\n\r\nor report compile time error.\r\n\r\nRegards"},"comment":{"url":"https://api.github.com/repos/purescript/purescript/issues/comments/156774036","html_url":"https://github.com/purescript/purescript/issues/824#issuecomment-156774036","issue_url":"https://api.github.com/repos/purescript/purescript/issues/824","id":156774036,"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},"created_at":"2015-11-15T02:51:43Z","updated_at":"2015-11-15T02:51:43Z","body":"The generated code is now\r\n\r\n```purescript\r\nexports[\"null\"] = $foreign[\"null\"];\r\nexports[\"undefined\"] = $foreign.undefined;\r\n```\r\n\r\nwhich works when run, but seems a bit ... dodgy. Should we escape `undefined` like `null` here?"}}