{"action":"created","issue":{"url":"https://api.github.com/repos/elm-lang/elm-compiler/issues/999","labels_url":"https://api.github.com/repos/elm-lang/elm-compiler/issues/999/labels{/name}","comments_url":"https://api.github.com/repos/elm-lang/elm-compiler/issues/999/comments","events_url":"https://api.github.com/repos/elm-lang/elm-compiler/issues/999/events","html_url":"https://github.com/elm-lang/elm-compiler/issues/999","id":96608631,"number":999,"title":"Unexpected behavior in recursive data structure declarations","user":{"login":"jdavidberger","id":8194827,"avatar_url":"https://avatars.githubusercontent.com/u/8194827?v=3","gravatar_id":"","url":"https://api.github.com/users/jdavidberger","html_url":"https://github.com/jdavidberger","followers_url":"https://api.github.com/users/jdavidberger/followers","following_url":"https://api.github.com/users/jdavidberger/following{/other_user}","gists_url":"https://api.github.com/users/jdavidberger/gists{/gist_id}","starred_url":"https://api.github.com/users/jdavidberger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdavidberger/subscriptions","organizations_url":"https://api.github.com/users/jdavidberger/orgs","repos_url":"https://api.github.com/users/jdavidberger/repos","events_url":"https://api.github.com/users/jdavidberger/events{/privacy}","received_events_url":"https://api.github.com/users/jdavidberger/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-07-22T16:22:44Z","updated_at":"2015-07-22T19:49:54Z","closed_at":null,"body":"See: http://share-elm.com/sprout/55afc18ae4b06aacf0e8b605.\r\n\r\nIt seems like cyclic declarations are not always doing expected things. The output mechanism initializes b first, so it resolves a as undefined and this leads to crashes. Swap the order of declarations or which node you are inspecting and it works.\r\n\r\nI'm unsure on how tractable this issue will turn out to be given the current output mechanisms, but it'd be very nice to have supported. But even without that support, there should be a consistent cycle detector and a compile error for it. \r\n\r\nNote this related issue in an elm library: https://github.com/Dandandan/parser/issues/15#issuecomment-123765681\r\n"},"comment":{"url":"https://api.github.com/repos/elm-lang/elm-compiler/issues/comments/123843464","html_url":"https://github.com/elm-lang/elm-compiler/issues/999#issuecomment-123843464","issue_url":"https://api.github.com/repos/elm-lang/elm-compiler/issues/999","id":123843464,"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-07-22T19:49:54Z","updated_at":"2015-07-22T19:49:54Z","body":"Okay, I'm going to close as a duplicate then :)\r\n\r\nI personally think the syntactic thing that OCaml is restrictive enough to be kind of useless. In any case, part of Joey's work on dead code elimination will make it quite easy to detect safe recursive values and allow them when the recursion is guarded by a lambda. I don't know if we will go farther than that. Let's revisit this once the initial restrictive implementation is released."}}