{"action":"created","issue":{"url":"https://api.github.com/repos/mjambon/atd/issues/152","repository_url":"https://api.github.com/repos/mjambon/atd","labels_url":"https://api.github.com/repos/mjambon/atd/issues/152/labels{/name}","comments_url":"https://api.github.com/repos/mjambon/atd/issues/152/comments","events_url":"https://api.github.com/repos/mjambon/atd/issues/152/events","html_url":"https://github.com/mjambon/atd/issues/152","id":356407517,"node_id":"MDU6SXNzdWUzNTY0MDc1MTc=","number":152,"title":"Bucklescript backend fails with recursive records types","user":{"login":"jorisgio","id":1108145,"node_id":"MDQ6VXNlcjExMDgxNDU=","avatar_url":"https://avatars2.githubusercontent.com/u/1108145?v=4","gravatar_id":"","url":"https://api.github.com/users/jorisgio","html_url":"https://github.com/jorisgio","followers_url":"https://api.github.com/users/jorisgio/followers","following_url":"https://api.github.com/users/jorisgio/following{/other_user}","gists_url":"https://api.github.com/users/jorisgio/gists{/gist_id}","starred_url":"https://api.github.com/users/jorisgio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jorisgio/subscriptions","organizations_url":"https://api.github.com/users/jorisgio/orgs","repos_url":"https://api.github.com/users/jorisgio/repos","events_url":"https://api.github.com/users/jorisgio/events{/privacy}","received_events_url":"https://api.github.com/users/jorisgio/received_events","type":"User","site_admin":false},"labels":[{"id":1044534885,"node_id":"MDU6TGFiZWwxMDQ0NTM0ODg1","url":"https://api.github.com/repos/mjambon/atd/labels/bucklescript","name":"bucklescript","color":"7ed2f7","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-09-03T08:35:49Z","updated_at":"2018-09-09T08:27:24Z","closed_at":null,"author_association":"NONE","body":"Recursive records type like \r\n```ocaml\r\ntype container = {\r\n  id: string;\r\n  children: container list;\r\n}\r\n```\r\ngenerate a decoder like\r\n\r\n```ocaml\r\n\r\n​let rec read__2 js = (\r\n  Atdgen_codec_runtime.Decode.list (\r\n    read_container\r\n  )\r\n) js\r\nand read_container = (\r\n  Atdgen_codec_runtime.Decode.make (fun json ->\r\n    (\r\n      ({\r\n          id =\r\n            Atdgen_codec_runtime.Decode.decode\r\n            (\r\n              Atdgen_codec_runtime.Decode.string\r\n              |> Atdgen_codec_runtime.Decode.field \"id\"\r\n            ) json;\r\n          children =\r\n            Atdgen_codec_runtime.Decode.decode\r\n            (\r\n              read__2\r\n              |> Atdgen_codec_runtime.Decode.field \"children\"\r\n            ) json;\r\n      } : container)\r\n    )\r\n  )\r\n)\r\n```\r\nbut type of make is abstracted : \r\n\r\nhttps://github.com/mjambon/atd/blob/fa14d651cf4b760bc6c73350a5e9dcf96f4c2bdf/atdgen-codec-runtime/src/decode.mli#L3 \r\n\r\nso even if the runtime uses a functional value as decoder type, compiler will reject `let rec`. This is working with normal yojson backend as a lambda is emitted.\r\nProbably need to change the record decoder to emit explicit lambda : \r\nhttps://github.com/mjambon/atd/blob/fa14d651cf4b760bc6c73350a5e9dcf96f4c2bdf/atdgen/src/obuckle_emit.ml#L131"},"comment":{"url":"https://api.github.com/repos/mjambon/atd/issues/comments/419699388","html_url":"https://github.com/mjambon/atd/issues/152#issuecomment-419699388","issue_url":"https://api.github.com/repos/mjambon/atd/issues/152","id":419699388,"node_id":"MDEyOklzc3VlQ29tbWVudDQxOTY5OTM4OA==","user":{"login":"mjambon","id":343265,"node_id":"MDQ6VXNlcjM0MzI2NQ==","avatar_url":"https://avatars3.githubusercontent.com/u/343265?v=4","gravatar_id":"","url":"https://api.github.com/users/mjambon","html_url":"https://github.com/mjambon","followers_url":"https://api.github.com/users/mjambon/followers","following_url":"https://api.github.com/users/mjambon/following{/other_user}","gists_url":"https://api.github.com/users/mjambon/gists{/gist_id}","starred_url":"https://api.github.com/users/mjambon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mjambon/subscriptions","organizations_url":"https://api.github.com/users/mjambon/orgs","repos_url":"https://api.github.com/users/mjambon/repos","events_url":"https://api.github.com/users/mjambon/events{/privacy}","received_events_url":"https://api.github.com/users/mjambon/received_events","type":"User","site_admin":false},"created_at":"2018-09-09T08:27:24Z","updated_at":"2018-09-09T08:27:24Z","author_association":"OWNER","body":"Updated #158. Hope this helps."}}
{"actor":{"display_login":"mjambon"}}