{"action":"created","issue":{"url":"https://api.github.com/repos/nikita-volkov/hasql-postgres/issues/15","labels_url":"https://api.github.com/repos/nikita-volkov/hasql-postgres/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/nikita-volkov/hasql-postgres/issues/15/comments","events_url":"https://api.github.com/repos/nikita-volkov/hasql-postgres/issues/15/events","html_url":"https://github.com/nikita-volkov/hasql-postgres/issues/15","id":67165239,"number":15,"title":"Export more","user":{"login":"mikeplus64","id":979001,"avatar_url":"https://avatars.githubusercontent.com/u/979001?v=3","gravatar_id":"","url":"https://api.github.com/users/mikeplus64","html_url":"https://github.com/mikeplus64","followers_url":"https://api.github.com/users/mikeplus64/followers","following_url":"https://api.github.com/users/mikeplus64/following{/other_user}","gists_url":"https://api.github.com/users/mikeplus64/gists{/gist_id}","starred_url":"https://api.github.com/users/mikeplus64/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikeplus64/subscriptions","organizations_url":"https://api.github.com/users/mikeplus64/orgs","repos_url":"https://api.github.com/users/mikeplus64/repos","events_url":"https://api.github.com/users/mikeplus64/events{/privacy}","received_events_url":"https://api.github.com/users/mikeplus64/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-04-08T16:15:25Z","updated_at":"2015-04-09T02:21:03Z","closed_at":null,"body":"At the moment you can't write instances for `CxValue` or `CxRow` for anything, since neither the `StmtParam` nor the `ResultValue` constructors are exported. (I need `CxValue` instances for non-homogenous data, which I can get by using the JSON Value instance, but that is quite a roundabout method. Tuple instances for `CxValue` would also work I guess, but still in a kind of roundabout way -- I'd be immediately repackaging them anyway)"},"comment":{"url":"https://api.github.com/repos/nikita-volkov/hasql-postgres/issues/comments/91093859","html_url":"https://github.com/nikita-volkov/hasql-postgres/issues/15#issuecomment-91093859","issue_url":"https://api.github.com/repos/nikita-volkov/hasql-postgres/issues/15","id":91093859,"user":{"login":"mikeplus64","id":979001,"avatar_url":"https://avatars.githubusercontent.com/u/979001?v=3","gravatar_id":"","url":"https://api.github.com/users/mikeplus64","html_url":"https://github.com/mikeplus64","followers_url":"https://api.github.com/users/mikeplus64/followers","following_url":"https://api.github.com/users/mikeplus64/following{/other_user}","gists_url":"https://api.github.com/users/mikeplus64/gists{/gist_id}","starred_url":"https://api.github.com/users/mikeplus64/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikeplus64/subscriptions","organizations_url":"https://api.github.com/users/mikeplus64/orgs","repos_url":"https://api.github.com/users/mikeplus64/repos","events_url":"https://api.github.com/users/mikeplus64/events{/privacy}","received_events_url":"https://api.github.com/users/mikeplus64/received_events","type":"User","site_admin":false},"created_at":"2015-04-09T02:21:03Z","updated_at":"2015-04-09T02:21:03Z","body":"`hasql-postgres` doesn't (and can't) support any queries that use `array_agg` on \"heterogeneous\" (... homogenously heterogenous? :) I mean things that don't have the same type for all fields - ie, pretty well any table you'd actually use) data.\r\n\r\nI want `StmtParam` and `ResultValue` exported, so we can write our own `CxRow` and `CxValue` instances. I suppose you'd also need more of `Mapping` exported for that to be possible (and convenient).\r\n\r\nIt's extremely cumbersome to work with many-element tuples, so I (and I expect everybody else...) repackage results from queries into custom types. The overhead is unnecessary, and the tuple to record code is very precarious. It's easier to be reason about clear code.\r\n\r\n```SQL\r\nCREATE TABLE tag(id INT PRIMARY KEY, name TEXT);\r\nCREATE TABLE post (id INT PRIMARY KEY, ... lots of stuff ...);\r\nCREATE TABLE post_to_tag(post INT REFERENCES post(id), tag INT REFERENCES tag(id));\r\n```\r\n\r\nHere's a query that we can't do with these tables, with `hasql-postgres`:\r\n\r\n```SQL\r\nSELECT post.*, array_agg(tag.*) AS tags \r\nFROM post \r\n  JOIN post_to_tag ON post_to_tag.post = post.id \r\n  JOIN tag ON post_to_tag.tag = tag.id \r\nGROUP BY post.id; \r\n```\r\n\r\nIt would be possible with tuple instances for `CxValue` (I don't know whether you'd want to use a `Mapping` instance behind the scenes), or with a custom instance for the Haskell-side `Tag` type."}}