Generation of tuple instances for FromRow with huge arities using TH macro#91
Generation of tuple instances for FromRow with huge arities using TH macro#91nikita-volkov wants to merge 1 commit intolpsmith:masterfrom
Conversation
|
Looks good, I'll probably merge this when I get around to fixing it. I suspect that you don't really need to change the |
|
Ok, looking at it again you do need to tweak the |
|
Ok, I did look at it a bit just now, for probably just over an hour. I must admit, I'm as confused as you are. GHC isn't producing very helpful error messages on this one. I suspect it's some kind of special interaction between Template Haskell and recursive modules, but I haven't found any write up of these issues. Although the wiki hints that maybe |
|
A pity. |
|
Care to publish it as a separate package? Being able to use native tuples for n > 8 would be splendid. Here's what I've been using so far: -- | Works almost like '(:.)' for 'ToField' instances. Start with `()`
-- and append as many fields as needed:
--
-- > () :* f1 :* f2 :* f3
--
-- Initial `()` saves the type hassle.
data a :* b = a :* b deriving (Eq, Ord, Show, Read)
infixl 3 :*
instance (ToRow a, ToField b) => ToRow (a :* b) where
toRow (a :* b) = toRow $ a :. (Only b) |
|
@dzhus I don't see much reason to. It really should be in the postgresql-simple project. You have my confirmation if you intend to do it yourself however. It should also be noted that integrating the code in the associated commit into any project is seamless. |
This macro is tested to work fine in my personal projects. But after spending an hour trying to integrate it into the maze of internal cyclic dependencies of "postgresql-simple" I gave up. Anyway, I'm still posting this for you to catch on with the integration work.