{"action":"created","issue":{"url":"https://api.github.com/repos/maurer/c-storable-deriving/issues/6","repository_url":"https://api.github.com/repos/maurer/c-storable-deriving","labels_url":"https://api.github.com/repos/maurer/c-storable-deriving/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/maurer/c-storable-deriving/issues/6/comments","events_url":"https://api.github.com/repos/maurer/c-storable-deriving/issues/6/events","html_url":"https://github.com/maurer/c-storable-deriving/issues/6","id":123065876,"number":6,"title":"Feature Request: example of :+:","user":{"login":"jimcrayne","id":4985051,"avatar_url":"https://avatars.githubusercontent.com/u/4985051?v=3","gravatar_id":"","url":"https://api.github.com/users/jimcrayne","html_url":"https://github.com/jimcrayne","followers_url":"https://api.github.com/users/jimcrayne/followers","following_url":"https://api.github.com/users/jimcrayne/following{/other_user}","gists_url":"https://api.github.com/users/jimcrayne/gists{/gist_id}","starred_url":"https://api.github.com/users/jimcrayne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimcrayne/subscriptions","organizations_url":"https://api.github.com/users/jimcrayne/orgs","repos_url":"https://api.github.com/users/jimcrayne/repos","events_url":"https://api.github.com/users/jimcrayne/events{/privacy}","received_events_url":"https://api.github.com/users/jimcrayne/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-12-19T06:15:47Z","updated_at":"2016-04-26T03:23:08Z","closed_at":null,"body":"Although I can understand not supporting sum types out of the box, as it isn't obvious what those instances should look like, I would find it helpful/useful to have some example code that facilitates automatic derivation of CStorable instances for sum types, perhaps as part of the documentation if not an official part of the library.\r\n\r\nFeels a little strange jumping right in to this request, without saying it so let me also add: Thankyou for what you are doing/have done. This is a useful package."},"comment":{"url":"https://api.github.com/repos/maurer/c-storable-deriving/issues/comments/214595626","html_url":"https://github.com/maurer/c-storable-deriving/issues/6#issuecomment-214595626","issue_url":"https://api.github.com/repos/maurer/c-storable-deriving/issues/6","id":214595626,"user":{"login":"jimcrayne","id":4985051,"avatar_url":"https://avatars.githubusercontent.com/u/4985051?v=3","gravatar_id":"","url":"https://api.github.com/users/jimcrayne","html_url":"https://github.com/jimcrayne","followers_url":"https://api.github.com/users/jimcrayne/followers","following_url":"https://api.github.com/users/jimcrayne/following{/other_user}","gists_url":"https://api.github.com/users/jimcrayne/gists{/gist_id}","starred_url":"https://api.github.com/users/jimcrayne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimcrayne/subscriptions","organizations_url":"https://api.github.com/users/jimcrayne/orgs","repos_url":"https://api.github.com/users/jimcrayne/repos","events_url":"https://api.github.com/users/jimcrayne/events{/privacy}","received_events_url":"https://api.github.com/users/jimcrayne/received_events","type":"User","site_admin":false},"created_at":"2016-04-26T03:23:08Z","updated_at":"2016-04-26T03:23:08Z","body":"well, i think it would be more useful to have something like\r\n\r\n> data Thing = Foo { foo1 :: CInt} | Bar { bar1 :: CChar }\r\n\r\nbecomes two c types, and a union for the fields like so\r\n```\r\nenum ThingType {\r\n  thingTypeFoo, \r\n  thingTypeBar\r\n};\r\n\r\n/* for missing field names just append a number to the data constructor made lower case */\r\nunion ThingFieldsUnionTag {\r\n   foo1 :: Int  \r\n   bar1:: char\r\n};\r\ntypedef union ThingFieldsUnionTag ThingFields;\r\n \r\nstruct ThingStructTag {\r\n  ThingType type;\r\n  ThingFields fields;  \r\n};\r\n\r\ntypedef struct ThingStructTag Thing;\r\n```\r\n\r\nThe idea is to have a common representation that works, like i said, it doesn't necessarily _have_ to be implemented in the library, but it just would be nice to at least have an example documenting how to do this.\r\n"}}