{"action":"created","issue":{"url":"https://api.github.com/repos/whitequark/ppx_deriving/issues/23","labels_url":"https://api.github.com/repos/whitequark/ppx_deriving/issues/23/labels{/name}","comments_url":"https://api.github.com/repos/whitequark/ppx_deriving/issues/23/comments","events_url":"https://api.github.com/repos/whitequark/ppx_deriving/issues/23/events","html_url":"https://github.com/whitequark/ppx_deriving/issues/23","id":59840088,"number":23,"title":"deriving show recursive, polymorphic types","user":{"login":"choeger","id":179956,"avatar_url":"https://avatars.githubusercontent.com/u/179956?v=3","gravatar_id":"","url":"https://api.github.com/users/choeger","html_url":"https://github.com/choeger","followers_url":"https://api.github.com/users/choeger/followers","following_url":"https://api.github.com/users/choeger/following{/other_user}","gists_url":"https://api.github.com/users/choeger/gists{/gist_id}","starred_url":"https://api.github.com/users/choeger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/choeger/subscriptions","organizations_url":"https://api.github.com/users/choeger/orgs","repos_url":"https://api.github.com/users/choeger/repos","events_url":"https://api.github.com/users/choeger/events{/privacy}","received_events_url":"https://api.github.com/users/choeger/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-04T18:32:04Z","updated_at":"2015-03-06T13:21:21Z","closed_at":null,"body":"When you try to derive for a type like:\r\n\r\n```\r\ntype foo = F of int | B of int bar | C of float bar\r\ntype 'a bar = { x : 'a ; r : Foo } \r\n```\r\n\r\nYou will end up with recursive functions:\r\n\r\n```\r\nlet rec pp_foo ...\r\nand pp_bar poly_a ...\r\n```\r\n\r\nHowever, the recursive binding does not allow for multiple instantiations of the polymorphic argument. Hence, you should probably move that out of the recursive group.\r\n"},"comment":{"url":"https://api.github.com/repos/whitequark/ppx_deriving/issues/comments/77557337","html_url":"https://github.com/whitequark/ppx_deriving/issues/23#issuecomment-77557337","issue_url":"https://api.github.com/repos/whitequark/ppx_deriving/issues/23","id":77557337,"user":{"login":"choeger","id":179956,"avatar_url":"https://avatars.githubusercontent.com/u/179956?v=3","gravatar_id":"","url":"https://api.github.com/users/choeger","html_url":"https://github.com/choeger","followers_url":"https://api.github.com/users/choeger/followers","following_url":"https://api.github.com/users/choeger/following{/other_user}","gists_url":"https://api.github.com/users/choeger/gists{/gist_id}","starred_url":"https://api.github.com/users/choeger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/choeger/subscriptions","organizations_url":"https://api.github.com/users/choeger/orgs","repos_url":"https://api.github.com/users/choeger/repos","events_url":"https://api.github.com/users/choeger/events{/privacy}","received_events_url":"https://api.github.com/users/choeger/received_events","type":"User","site_admin":false},"created_at":"2015-03-06T13:21:21Z","updated_at":"2015-03-06T13:21:21Z","body":"Here is a non-working example:\r\n`\r\ntype foo = Foo of int | Bar of int baz | Baz of float baz and 'a baz = {a : 'a} [@@deriving show] ;;\r\n`\r\nThe reusage of the structure of `baz` is a useful pattern in real-world applications (since structures tend to occur repeatedly). However, inside the \"head\" `foo` there may be a finite amount of instantiations of `baz`, deriving only allows for one currently. To solve that, one would have to factor out these instantiations and create pretty-printers for each one."}}