{"action":"opened","issue":{"url":"https://api.github.com/repos/janestreet/ppx_fields_conv/issues/1","labels_url":"https://api.github.com/repos/janestreet/ppx_fields_conv/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/janestreet/ppx_fields_conv/issues/1/comments","events_url":"https://api.github.com/repos/janestreet/ppx_fields_conv/issues/1/events","html_url":"https://github.com/janestreet/ppx_fields_conv/issues/1","id":130471840,"number":1,"title":"Mapping polymorphic values","user":{"login":"mmottl","id":1189131,"avatar_url":"https://avatars.githubusercontent.com/u/1189131?v=3","gravatar_id":"","url":"https://api.github.com/users/mmottl","html_url":"https://github.com/mmottl","followers_url":"https://api.github.com/users/mmottl/followers","following_url":"https://api.github.com/users/mmottl/following{/other_user}","gists_url":"https://api.github.com/users/mmottl/gists{/gist_id}","starred_url":"https://api.github.com/users/mmottl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmottl/subscriptions","organizations_url":"https://api.github.com/users/mmottl/orgs","repos_url":"https://api.github.com/users/mmottl/repos","events_url":"https://api.github.com/users/mmottl/events{/privacy}","received_events_url":"https://api.github.com/users/mmottl/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-02-01T20:22:23Z","updated_at":"2016-02-01T20:22:23Z","closed_at":null,"body":"One useful feature that the fields and variants converters are missing is how to perform structure-preserving maps, e.g. (using `fmap` in Haskell-spirit):\r\n\r\n```ocaml\r\ntype ('a, 'b) t = { foo : 'a; bar : 'b option } with fields\r\n```\r\n\r\nThe above would produce a function with the following sigature:\r\n```ocaml\r\nval fmap : a : ('a1 -> 'a2) -> b : ('b1 -> 'b2) -> ('a1, 'b1) t -> ('a2, 'b2) t\r\n```\r\n\r\nMaybe such a feature could also be implemented in a separate preprocessor library."}}