mssql-simple 0.4.0.1 → 0.4.0.2
raw patch · 7 files changed
+447/−1288 lines, 7 filesdep +template-haskellPVP ok
version bump matches the API change (PVP)
Dependencies added: template-haskell
API changes (from Hackage documentation)
Files
- mssql-simple.cabal +5/−2
- src/Database/MSSQLServer/Query.hs +1/−0
- src/Database/MSSQLServer/Query/ResultSet.hs +17/−43
- src/Database/MSSQLServer/Query/Row.hs +16/−512
- src/Database/MSSQLServer/Query/RpcQuerySet.hs +50/−147
- src/Database/MSSQLServer/Query/RpcResponseSet.hs +67/−584
- src/Database/MSSQLServer/Query/Template.hs +291/−0
mssql-simple.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: fa5d1ef6133a1e7953b1b0d2bcebee5d30cc1e56cf2cfd77bf02bd73a9dcaaec+-- hash: 3fdeca9ccee2c838ec977f3ba9cecc1833abeb358e2c85be382050d6cf7522ad name: mssql-simple-version: 0.4.0.1+version: 0.4.0.2 synopsis: SQL Server client library implemented in Haskell description: Please see the README on GitHub at <https://github.com/mitsuji/mssql-simple#readme> category: Database@@ -36,6 +36,7 @@ Database.MSSQLServer.Query.Row Database.MSSQLServer.Query.RpcQuerySet Database.MSSQLServer.Query.RpcResponseSet+ Database.MSSQLServer.Query.Template Database.MSSQLServer.Query.TokenStreamParser other-modules: Paths_mssql_simple@@ -48,6 +49,7 @@ , hostname , ms-tds >=0.3 && <0.4 , network+ , template-haskell , text , time , tls@@ -69,6 +71,7 @@ , ms-tds >=0.3 && <0.4 , mssql-simple , network+ , template-haskell , text , time , tls
src/Database/MSSQLServer/Query.hs view
@@ -39,6 +39,7 @@ , QueryError (..) ) where +import Control.Applicative((<$>)) import Data.Monoid ((<>)) import Data.Typeable(Typeable)
src/Database/MSSQLServer/Query/ResultSet.hs view
@@ -1,6 +1,8 @@ {-# OPTIONS_HADDOCK hide #-} {-# LANGUAGE BangPatterns #-}+{-# LANGUAGE TemplateHaskell #-} + module Database.MSSQLServer.Query.ResultSet ( ResultSet (..) , Result (..) ) where@@ -10,9 +12,13 @@ import Database.MSSQLServer.Query.Row import Database.MSSQLServer.Query.Only import Database.MSSQLServer.Query.TokenStreamParser+import Database.MSSQLServer.Query.Template +import Control.Monad(forM)+import Language.Haskell.TH (runIO,pprint) + class ResultSet a where resultSetParser :: Parser a @@ -27,49 +33,17 @@ resultSetParser = rowCount --- [TODO] use Template Haskell-instance (Result a, Result b) => ResultSet (a, b) where- resultSetParser = p- where- p :: (Result a, Result b) => Parser (a, b)- p = do- !r1 <- resultParser :: (Result a) => Parser a- !r2 <- resultParser :: (Result b) => Parser b- return (r1,r2)--instance (Result a, Result b, Result c) => ResultSet (a, b, c) where- resultSetParser = p- where- p :: (Result a, Result b, Result c) => Parser (a, b, c)- p = do- !r1 <- resultParser :: (Result a) => Parser a- !r2 <- resultParser :: (Result b) => Parser b- !r3 <- resultParser :: (Result c) => Parser c- return (r1,r2,r3)--instance (Result a, Result b, Result c, Result d) => ResultSet (a, b, c, d) where- resultSetParser = p- where- p :: (Result a, Result b, Result c, Result d) => Parser (a, b, c, d)- p = do- !r1 <- resultParser :: (Result a) => Parser a- !r2 <- resultParser :: (Result b) => Parser b- !r3 <- resultParser :: (Result c) => Parser c- !r4 <- resultParser :: (Result d) => Parser d- return (r1,r2,r3,r4)--instance (Result a, Result b, Result c, Result d, Result e) => ResultSet (a, b, c, d, e) where- resultSetParser = p- where- p :: (Result a, Result b, Result c, Result d, Result e) => Parser (a, b, c, d, e)- p = do- !r1 <- resultParser :: (Result a) => Parser a- !r2 <- resultParser :: (Result b) => Parser b- !r3 <- resultParser :: (Result c) => Parser c- !r4 <- resultParser :: (Result d) => Parser d- !r5 <- resultParser :: (Result e) => Parser e- return (r1,r2,r3,r4,r5)-+-- [MEMO] using Template Haskell+forM [2..30] $ \n -> do+ dec <- resultSetTupleQ n+-- runIO $ putStrLn $ pprint dec+ return dec+--instance (Result a, Result b) => ResultSet (a, b) where+-- resultSetParser = do+-- !r1 <- resultParser :: (Result a) => Parser a+-- !r2 <- resultParser :: (Result b) => Parser b+-- return (r1,r2)+-- class Result a where
src/Database/MSSQLServer/Query/Row.hs view
@@ -1,12 +1,16 @@ {-# OPTIONS_HADDOCK hide #-} {-# LANGUAGE BangPatterns #-}+{-# LANGUAGE TemplateHaskell #-} module Database.MSSQLServer.Query.Row ( Row (..) ) where import Database.Tds.Message import Database.MSSQLServer.Query.Only+import Database.MSSQLServer.Query.Template +import Control.Monad(forM)+import Language.Haskell.TH (runIO,pprint) mcdTypeInfo :: MetaColumnData -> TypeInfo mcdTypeInfo (MetaColumnData _ _ ti _ _) = ti@@ -15,521 +19,21 @@ class Row a where fromListOfRawBytes :: [MetaColumnData] -> [RawBytes] -> a --- [TODO] use Template Haskell instance (Data a) => Row (Only a) where fromListOfRawBytes [m1] [b1] = Only d1 where !d1 = fromRawBytes (mcdTypeInfo m1) b1 fromListOfRawBytes _ _ = error "fromListOfRawBytes: List length must be 1" -instance (Data a, Data b) => Row (a,b) where- fromListOfRawBytes [m1,m2] [b1,b2] = (d1,d2)- where- !d1 = fromRawBytes (mcdTypeInfo m1) b1- !d2 = fromRawBytes (mcdTypeInfo m2) b2- fromListOfRawBytes _ _ = error "fromListOfRawBytes: List length must be 2"--instance (Data a, Data b, Data c) => Row (a,b,c) where- fromListOfRawBytes [m1,m2,m3] [b1,b2,b3] = (d1,d2,d3)- where- !d1 = fromRawBytes (mcdTypeInfo m1) b1- !d2 = fromRawBytes (mcdTypeInfo m2) b2- !d3 = fromRawBytes (mcdTypeInfo m3) b3- fromListOfRawBytes _ _ = error "fromListOfRawBytes: List length must be 3"--instance (Data a, Data b, Data c, Data d) => Row (a,b,c,d) where- fromListOfRawBytes [m1,m2,m3,m4] [b1,b2,b3,b4] = (d1,d2,d3,d4)- where- !d1 = fromRawBytes (mcdTypeInfo m1) b1- !d2 = fromRawBytes (mcdTypeInfo m2) b2- !d3 = fromRawBytes (mcdTypeInfo m3) b3- !d4 = fromRawBytes (mcdTypeInfo m4) b4- fromListOfRawBytes _ _ = error "fromListOfRawBytes: List length must be 4"--instance (Data a, Data b, Data c, Data d, Data e) => Row (a,b,c,d,e) where- fromListOfRawBytes [m1,m2,m3,m4,m5] [b1,b2,b3,b4,b5] = (d1,d2,d3,d4,d5)- where- !d1 = fromRawBytes (mcdTypeInfo m1) b1- !d2 = fromRawBytes (mcdTypeInfo m2) b2- !d3 = fromRawBytes (mcdTypeInfo m3) b3- !d4 = fromRawBytes (mcdTypeInfo m4) b4- !d5 = fromRawBytes (mcdTypeInfo m5) b5- fromListOfRawBytes _ _ = error "fromListOfRawBytes: List length must be 5"--instance (Data a, Data b, Data c, Data d, Data e, Data f) => Row (a,b,c,d,e,f) where- fromListOfRawBytes [m1,m2,m3,m4,m5,m6] [b1,b2,b3,b4,b5,b6] = (d1,d2,d3,d4,d5,d6)- where- !d1 = fromRawBytes (mcdTypeInfo m1) b1- !d2 = fromRawBytes (mcdTypeInfo m2) b2- !d3 = fromRawBytes (mcdTypeInfo m3) b3- !d4 = fromRawBytes (mcdTypeInfo m4) b4- !d5 = fromRawBytes (mcdTypeInfo m5) b5- !d6 = fromRawBytes (mcdTypeInfo m6) b6- fromListOfRawBytes _ _ = error "fromListOfRawBytes: List length must be 6"--instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g) => Row (a,b,c,d,e,f,g) where- fromListOfRawBytes [m1,m2,m3,m4,m5,m6,m7] [b1,b2,b3,b4,b5,b6,b7] = (d1,d2,d3,d4,d5,d6,d7)- where- !d1 = fromRawBytes (mcdTypeInfo m1) b1- !d2 = fromRawBytes (mcdTypeInfo m2) b2- !d3 = fromRawBytes (mcdTypeInfo m3) b3- !d4 = fromRawBytes (mcdTypeInfo m4) b4- !d5 = fromRawBytes (mcdTypeInfo m5) b5- !d6 = fromRawBytes (mcdTypeInfo m6) b6- !d7 = fromRawBytes (mcdTypeInfo m7) b7- fromListOfRawBytes _ _ = error "fromListOfRawBytes: List length must be 7"--instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h) => Row (a,b,c,d,e,f,g,h) where- fromListOfRawBytes [m1,m2,m3,m4,m5,m6,m7,m8] [b1,b2,b3,b4,b5,b6,b7,b8] = (d1,d2,d3,d4,d5,d6,d7,d8)- where- !d1 = fromRawBytes (mcdTypeInfo m1) b1- !d2 = fromRawBytes (mcdTypeInfo m2) b2- !d3 = fromRawBytes (mcdTypeInfo m3) b3- !d4 = fromRawBytes (mcdTypeInfo m4) b4- !d5 = fromRawBytes (mcdTypeInfo m5) b5- !d6 = fromRawBytes (mcdTypeInfo m6) b6- !d7 = fromRawBytes (mcdTypeInfo m7) b7- !d8 = fromRawBytes (mcdTypeInfo m8) b8- fromListOfRawBytes _ _ = error "fromListOfRawBytes: List length must be 8"--instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i) => Row (a,b,c,d,e,f,g,h,i) where- fromListOfRawBytes [m1,m2,m3,m4,m5,m6,m7,m8,m9] [b1,b2,b3,b4,b5,b6,b7,b8,b9] = (d1,d2,d3,d4,d5,d6,d7,d8,d9)- where- !d1 = fromRawBytes (mcdTypeInfo m1) b1- !d2 = fromRawBytes (mcdTypeInfo m2) b2- !d3 = fromRawBytes (mcdTypeInfo m3) b3- !d4 = fromRawBytes (mcdTypeInfo m4) b4- !d5 = fromRawBytes (mcdTypeInfo m5) b5- !d6 = fromRawBytes (mcdTypeInfo m6) b6- !d7 = fromRawBytes (mcdTypeInfo m7) b7- !d8 = fromRawBytes (mcdTypeInfo m8) b8- !d9 = fromRawBytes (mcdTypeInfo m9) b9- fromListOfRawBytes _ _ = error "fromListOfRawBytes: List length must be 9"--instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j) => Row (a,b,c,d,e,f,g,h,i,j) where- fromListOfRawBytes [m1,m2,m3,m4,m5,m6,m7,m8,m9,m10] [b1,b2,b3,b4,b5,b6,b7,b8,b9,b10] = (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10)- where- !d1 = fromRawBytes (mcdTypeInfo m1) b1- !d2 = fromRawBytes (mcdTypeInfo m2) b2- !d3 = fromRawBytes (mcdTypeInfo m3) b3- !d4 = fromRawBytes (mcdTypeInfo m4) b4- !d5 = fromRawBytes (mcdTypeInfo m5) b5- !d6 = fromRawBytes (mcdTypeInfo m6) b6- !d7 = fromRawBytes (mcdTypeInfo m7) b7- !d8 = fromRawBytes (mcdTypeInfo m8) b8- !d9 = fromRawBytes (mcdTypeInfo m9) b9- !d10 = fromRawBytes (mcdTypeInfo m10) b10- fromListOfRawBytes _ _ = error "fromListOfRawBytes: List length must be 10"--instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k) => Row (a,b,c,d,e,f,g,h,i,j,k) where- fromListOfRawBytes [m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11] [b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11]- = (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11)- where- !d1 = fromRawBytes (mcdTypeInfo m1) b1- !d2 = fromRawBytes (mcdTypeInfo m2) b2- !d3 = fromRawBytes (mcdTypeInfo m3) b3- !d4 = fromRawBytes (mcdTypeInfo m4) b4- !d5 = fromRawBytes (mcdTypeInfo m5) b5- !d6 = fromRawBytes (mcdTypeInfo m6) b6- !d7 = fromRawBytes (mcdTypeInfo m7) b7- !d8 = fromRawBytes (mcdTypeInfo m8) b8- !d9 = fromRawBytes (mcdTypeInfo m9) b9- !d10 = fromRawBytes (mcdTypeInfo m10) b10- !d11 = fromRawBytes (mcdTypeInfo m11) b11- fromListOfRawBytes _ _ = error "fromListOfRawBytes: List length must be 11"--instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l) => Row (a,b,c,d,e,f,g,h,i,j,k,l) where- fromListOfRawBytes [m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12] [b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12]- = (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12)- where- !d1 = fromRawBytes (mcdTypeInfo m1) b1- !d2 = fromRawBytes (mcdTypeInfo m2) b2- !d3 = fromRawBytes (mcdTypeInfo m3) b3- !d4 = fromRawBytes (mcdTypeInfo m4) b4- !d5 = fromRawBytes (mcdTypeInfo m5) b5- !d6 = fromRawBytes (mcdTypeInfo m6) b6- !d7 = fromRawBytes (mcdTypeInfo m7) b7- !d8 = fromRawBytes (mcdTypeInfo m8) b8- !d9 = fromRawBytes (mcdTypeInfo m9) b9- !d10 = fromRawBytes (mcdTypeInfo m10) b10- !d11 = fromRawBytes (mcdTypeInfo m11) b11- !d12 = fromRawBytes (mcdTypeInfo m12) b12- fromListOfRawBytes _ _ = error "fromListOfRawBytes: List length must be 12"--instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m) => Row (a,b,c,d,e,f,g,h,i,j,k,l,m) where- fromListOfRawBytes [m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13] [b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13]- = (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13)- where- !d1 = fromRawBytes (mcdTypeInfo m1) b1- !d2 = fromRawBytes (mcdTypeInfo m2) b2- !d3 = fromRawBytes (mcdTypeInfo m3) b3- !d4 = fromRawBytes (mcdTypeInfo m4) b4- !d5 = fromRawBytes (mcdTypeInfo m5) b5- !d6 = fromRawBytes (mcdTypeInfo m6) b6- !d7 = fromRawBytes (mcdTypeInfo m7) b7- !d8 = fromRawBytes (mcdTypeInfo m8) b8- !d9 = fromRawBytes (mcdTypeInfo m9) b9- !d10 = fromRawBytes (mcdTypeInfo m10) b10- !d11 = fromRawBytes (mcdTypeInfo m11) b11- !d12 = fromRawBytes (mcdTypeInfo m12) b12- !d13 = fromRawBytes (mcdTypeInfo m13) b13- fromListOfRawBytes _ _ = error "fromListOfRawBytes: List length must be 13"--instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m, Data n) => Row (a,b,c,d,e,f,g,h,i,j,k,l,m,n) where- fromListOfRawBytes [m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m14] [b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14]- = (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14)- where- !d1 = fromRawBytes (mcdTypeInfo m1) b1- !d2 = fromRawBytes (mcdTypeInfo m2) b2- !d3 = fromRawBytes (mcdTypeInfo m3) b3- !d4 = fromRawBytes (mcdTypeInfo m4) b4- !d5 = fromRawBytes (mcdTypeInfo m5) b5- !d6 = fromRawBytes (mcdTypeInfo m6) b6- !d7 = fromRawBytes (mcdTypeInfo m7) b7- !d8 = fromRawBytes (mcdTypeInfo m8) b8- !d9 = fromRawBytes (mcdTypeInfo m9) b9- !d10 = fromRawBytes (mcdTypeInfo m10) b10- !d11 = fromRawBytes (mcdTypeInfo m11) b11- !d12 = fromRawBytes (mcdTypeInfo m12) b12- !d13 = fromRawBytes (mcdTypeInfo m13) b13- !d14 = fromRawBytes (mcdTypeInfo m14) b14- fromListOfRawBytes _ _ = error "fromListOfRawBytes: List length must be 14"--instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m, Data n, Data o) =>- Row (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) where- fromListOfRawBytes [m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m14,m15] [b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15]- = (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15)- where- !d1 = fromRawBytes (mcdTypeInfo m1) b1- !d2 = fromRawBytes (mcdTypeInfo m2) b2- !d3 = fromRawBytes (mcdTypeInfo m3) b3- !d4 = fromRawBytes (mcdTypeInfo m4) b4- !d5 = fromRawBytes (mcdTypeInfo m5) b5- !d6 = fromRawBytes (mcdTypeInfo m6) b6- !d7 = fromRawBytes (mcdTypeInfo m7) b7- !d8 = fromRawBytes (mcdTypeInfo m8) b8- !d9 = fromRawBytes (mcdTypeInfo m9) b9- !d10 = fromRawBytes (mcdTypeInfo m10) b10- !d11 = fromRawBytes (mcdTypeInfo m11) b11- !d12 = fromRawBytes (mcdTypeInfo m12) b12- !d13 = fromRawBytes (mcdTypeInfo m13) b13- !d14 = fromRawBytes (mcdTypeInfo m14) b14- !d15 = fromRawBytes (mcdTypeInfo m15) b15- fromListOfRawBytes _ _ = error "fromListOfRawBytes: List length must be 15"--instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m, Data n, Data o, Data p) =>- Row (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) where- fromListOfRawBytes [m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m14,m15,m16] [b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16]- = (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16)- where- !d1 = fromRawBytes (mcdTypeInfo m1) b1- !d2 = fromRawBytes (mcdTypeInfo m2) b2- !d3 = fromRawBytes (mcdTypeInfo m3) b3- !d4 = fromRawBytes (mcdTypeInfo m4) b4- !d5 = fromRawBytes (mcdTypeInfo m5) b5- !d6 = fromRawBytes (mcdTypeInfo m6) b6- !d7 = fromRawBytes (mcdTypeInfo m7) b7- !d8 = fromRawBytes (mcdTypeInfo m8) b8- !d9 = fromRawBytes (mcdTypeInfo m9) b9- !d10 = fromRawBytes (mcdTypeInfo m10) b10- !d11 = fromRawBytes (mcdTypeInfo m11) b11- !d12 = fromRawBytes (mcdTypeInfo m12) b12- !d13 = fromRawBytes (mcdTypeInfo m13) b13- !d14 = fromRawBytes (mcdTypeInfo m14) b14- !d15 = fromRawBytes (mcdTypeInfo m15) b15- !d16 = fromRawBytes (mcdTypeInfo m16) b16- fromListOfRawBytes _ _ = error "fromListOfRawBytes: List length must be 16"--instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m, Data n, Data o, Data p, Data q) =>- Row (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) where- fromListOfRawBytes [m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m14,m15,m16,m17] [b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16,b17]- = (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16,d17)- where- !d1 = fromRawBytes (mcdTypeInfo m1) b1- !d2 = fromRawBytes (mcdTypeInfo m2) b2- !d3 = fromRawBytes (mcdTypeInfo m3) b3- !d4 = fromRawBytes (mcdTypeInfo m4) b4- !d5 = fromRawBytes (mcdTypeInfo m5) b5- !d6 = fromRawBytes (mcdTypeInfo m6) b6- !d7 = fromRawBytes (mcdTypeInfo m7) b7- !d8 = fromRawBytes (mcdTypeInfo m8) b8- !d9 = fromRawBytes (mcdTypeInfo m9) b9- !d10 = fromRawBytes (mcdTypeInfo m10) b10- !d11 = fromRawBytes (mcdTypeInfo m11) b11- !d12 = fromRawBytes (mcdTypeInfo m12) b12- !d13 = fromRawBytes (mcdTypeInfo m13) b13- !d14 = fromRawBytes (mcdTypeInfo m14) b14- !d15 = fromRawBytes (mcdTypeInfo m15) b15- !d16 = fromRawBytes (mcdTypeInfo m16) b16- !d17 = fromRawBytes (mcdTypeInfo m17) b17- fromListOfRawBytes _ _ = error "fromListOfRawBytes: List length must be 17"--instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m, Data n, Data o, Data p, Data q, Data r) =>- Row (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r) where- fromListOfRawBytes [m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m14,m15,m16,m17,m18] [b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16,b17,b18]- = (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16,d17,d18)- where- !d1 = fromRawBytes (mcdTypeInfo m1) b1- !d2 = fromRawBytes (mcdTypeInfo m2) b2- !d3 = fromRawBytes (mcdTypeInfo m3) b3- !d4 = fromRawBytes (mcdTypeInfo m4) b4- !d5 = fromRawBytes (mcdTypeInfo m5) b5- !d6 = fromRawBytes (mcdTypeInfo m6) b6- !d7 = fromRawBytes (mcdTypeInfo m7) b7- !d8 = fromRawBytes (mcdTypeInfo m8) b8- !d9 = fromRawBytes (mcdTypeInfo m9) b9- !d10 = fromRawBytes (mcdTypeInfo m10) b10- !d11 = fromRawBytes (mcdTypeInfo m11) b11- !d12 = fromRawBytes (mcdTypeInfo m12) b12- !d13 = fromRawBytes (mcdTypeInfo m13) b13- !d14 = fromRawBytes (mcdTypeInfo m14) b14- !d15 = fromRawBytes (mcdTypeInfo m15) b15- !d16 = fromRawBytes (mcdTypeInfo m16) b16- !d17 = fromRawBytes (mcdTypeInfo m17) b17- !d18 = fromRawBytes (mcdTypeInfo m18) b18- fromListOfRawBytes _ _ = error "fromListOfRawBytes: List length must be 18"--instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m, Data n, Data o, Data p, Data q, Data r, Data s) =>- Row (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s) where- fromListOfRawBytes [m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m14,m15,m16,m17,m18,m19] [b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16,b17,b18,b19]- = (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16,d17,d18,d19)- where- !d1 = fromRawBytes (mcdTypeInfo m1) b1- !d2 = fromRawBytes (mcdTypeInfo m2) b2- !d3 = fromRawBytes (mcdTypeInfo m3) b3- !d4 = fromRawBytes (mcdTypeInfo m4) b4- !d5 = fromRawBytes (mcdTypeInfo m5) b5- !d6 = fromRawBytes (mcdTypeInfo m6) b6- !d7 = fromRawBytes (mcdTypeInfo m7) b7- !d8 = fromRawBytes (mcdTypeInfo m8) b8- !d9 = fromRawBytes (mcdTypeInfo m9) b9- !d10 = fromRawBytes (mcdTypeInfo m10) b10- !d11 = fromRawBytes (mcdTypeInfo m11) b11- !d12 = fromRawBytes (mcdTypeInfo m12) b12- !d13 = fromRawBytes (mcdTypeInfo m13) b13- !d14 = fromRawBytes (mcdTypeInfo m14) b14- !d15 = fromRawBytes (mcdTypeInfo m15) b15- !d16 = fromRawBytes (mcdTypeInfo m16) b16- !d17 = fromRawBytes (mcdTypeInfo m17) b17- !d18 = fromRawBytes (mcdTypeInfo m18) b18- !d19 = fromRawBytes (mcdTypeInfo m19) b19- fromListOfRawBytes _ _ = error "fromListOfRawBytes: List length must be 19"--instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m, Data n, Data o, Data p, Data q, Data r, Data s- , Data t) =>- Row (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) where- fromListOfRawBytes [m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m14,m15,m16,m17,m18,m19,m20] [b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16,b17,b18,b19,b20]- = (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16,d17,d18,d19,d20)- where- !d1 = fromRawBytes (mcdTypeInfo m1) b1- !d2 = fromRawBytes (mcdTypeInfo m2) b2- !d3 = fromRawBytes (mcdTypeInfo m3) b3- !d4 = fromRawBytes (mcdTypeInfo m4) b4- !d5 = fromRawBytes (mcdTypeInfo m5) b5- !d6 = fromRawBytes (mcdTypeInfo m6) b6- !d7 = fromRawBytes (mcdTypeInfo m7) b7- !d8 = fromRawBytes (mcdTypeInfo m8) b8- !d9 = fromRawBytes (mcdTypeInfo m9) b9- !d10 = fromRawBytes (mcdTypeInfo m10) b10- !d11 = fromRawBytes (mcdTypeInfo m11) b11- !d12 = fromRawBytes (mcdTypeInfo m12) b12- !d13 = fromRawBytes (mcdTypeInfo m13) b13- !d14 = fromRawBytes (mcdTypeInfo m14) b14- !d15 = fromRawBytes (mcdTypeInfo m15) b15- !d16 = fromRawBytes (mcdTypeInfo m16) b16- !d17 = fromRawBytes (mcdTypeInfo m17) b17- !d18 = fromRawBytes (mcdTypeInfo m18) b18- !d19 = fromRawBytes (mcdTypeInfo m19) b19- !d20 = fromRawBytes (mcdTypeInfo m20) b20- fromListOfRawBytes _ _ = error "fromListOfRawBytes: List length must be 20"--instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m, Data n, Data o, Data p, Data q, Data r, Data s- , Data t, Data u) =>- Row (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u) where- fromListOfRawBytes [m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m14,m15,m16,m17,m18,m19,m20,m21] [b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16,b17,b18,b19,b20,b21]- = (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16,d17,d18,d19,d20,d21)- where- !d1 = fromRawBytes (mcdTypeInfo m1) b1- !d2 = fromRawBytes (mcdTypeInfo m2) b2- !d3 = fromRawBytes (mcdTypeInfo m3) b3- !d4 = fromRawBytes (mcdTypeInfo m4) b4- !d5 = fromRawBytes (mcdTypeInfo m5) b5- !d6 = fromRawBytes (mcdTypeInfo m6) b6- !d7 = fromRawBytes (mcdTypeInfo m7) b7- !d8 = fromRawBytes (mcdTypeInfo m8) b8- !d9 = fromRawBytes (mcdTypeInfo m9) b9- !d10 = fromRawBytes (mcdTypeInfo m10) b10- !d11 = fromRawBytes (mcdTypeInfo m11) b11- !d12 = fromRawBytes (mcdTypeInfo m12) b12- !d13 = fromRawBytes (mcdTypeInfo m13) b13- !d14 = fromRawBytes (mcdTypeInfo m14) b14- !d15 = fromRawBytes (mcdTypeInfo m15) b15- !d16 = fromRawBytes (mcdTypeInfo m16) b16- !d17 = fromRawBytes (mcdTypeInfo m17) b17- !d18 = fromRawBytes (mcdTypeInfo m18) b18- !d19 = fromRawBytes (mcdTypeInfo m19) b19- !d20 = fromRawBytes (mcdTypeInfo m20) b20- !d21 = fromRawBytes (mcdTypeInfo m21) b21- fromListOfRawBytes _ _ = error "fromListOfRawBytes: List length must be 21"--instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m, Data n, Data o, Data p, Data q, Data r, Data s- , Data t, Data u, Data v) =>- Row (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v) where- fromListOfRawBytes [m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m14,m15,m16,m17,m18,m19,m20,m21,m22] [b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16,b17,b18,b19,b20,b21,b22]- = (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16,d17,d18,d19,d20,d21,d22)- where- !d1 = fromRawBytes (mcdTypeInfo m1) b1- !d2 = fromRawBytes (mcdTypeInfo m2) b2- !d3 = fromRawBytes (mcdTypeInfo m3) b3- !d4 = fromRawBytes (mcdTypeInfo m4) b4- !d5 = fromRawBytes (mcdTypeInfo m5) b5- !d6 = fromRawBytes (mcdTypeInfo m6) b6- !d7 = fromRawBytes (mcdTypeInfo m7) b7- !d8 = fromRawBytes (mcdTypeInfo m8) b8- !d9 = fromRawBytes (mcdTypeInfo m9) b9- !d10 = fromRawBytes (mcdTypeInfo m10) b10- !d11 = fromRawBytes (mcdTypeInfo m11) b11- !d12 = fromRawBytes (mcdTypeInfo m12) b12- !d13 = fromRawBytes (mcdTypeInfo m13) b13- !d14 = fromRawBytes (mcdTypeInfo m14) b14- !d15 = fromRawBytes (mcdTypeInfo m15) b15- !d16 = fromRawBytes (mcdTypeInfo m16) b16- !d17 = fromRawBytes (mcdTypeInfo m17) b17- !d18 = fromRawBytes (mcdTypeInfo m18) b18- !d19 = fromRawBytes (mcdTypeInfo m19) b19- !d20 = fromRawBytes (mcdTypeInfo m20) b20- !d21 = fromRawBytes (mcdTypeInfo m21) b21- !d22 = fromRawBytes (mcdTypeInfo m22) b22- fromListOfRawBytes _ _ = error "fromListOfRawBytes: List length must be 22"--instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m, Data n, Data o, Data p, Data q, Data r, Data s- , Data t, Data u, Data v, Data w) =>- Row (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w) where- fromListOfRawBytes [m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m14,m15,m16,m17,m18,m19,m20,m21,m22,m23] [b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16,b17,b18,b19,b20,b21,b22,b23]- = (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16,d17,d18,d19,d20,d21,d22,d23)- where- !d1 = fromRawBytes (mcdTypeInfo m1) b1- !d2 = fromRawBytes (mcdTypeInfo m2) b2- !d3 = fromRawBytes (mcdTypeInfo m3) b3- !d4 = fromRawBytes (mcdTypeInfo m4) b4- !d5 = fromRawBytes (mcdTypeInfo m5) b5- !d6 = fromRawBytes (mcdTypeInfo m6) b6- !d7 = fromRawBytes (mcdTypeInfo m7) b7- !d8 = fromRawBytes (mcdTypeInfo m8) b8- !d9 = fromRawBytes (mcdTypeInfo m9) b9- !d10 = fromRawBytes (mcdTypeInfo m10) b10- !d11 = fromRawBytes (mcdTypeInfo m11) b11- !d12 = fromRawBytes (mcdTypeInfo m12) b12- !d13 = fromRawBytes (mcdTypeInfo m13) b13- !d14 = fromRawBytes (mcdTypeInfo m14) b14- !d15 = fromRawBytes (mcdTypeInfo m15) b15- !d16 = fromRawBytes (mcdTypeInfo m16) b16- !d17 = fromRawBytes (mcdTypeInfo m17) b17- !d18 = fromRawBytes (mcdTypeInfo m18) b18- !d19 = fromRawBytes (mcdTypeInfo m19) b19- !d20 = fromRawBytes (mcdTypeInfo m20) b20- !d21 = fromRawBytes (mcdTypeInfo m21) b21- !d22 = fromRawBytes (mcdTypeInfo m22) b22- !d23 = fromRawBytes (mcdTypeInfo m23) b23- fromListOfRawBytes _ _ = error "fromListOfRawBytes: List length must be 23"--instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m, Data n, Data o, Data p, Data q, Data r, Data s- , Data t, Data u, Data v, Data w, Data x) =>- Row (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x) where- fromListOfRawBytes [m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m14,m15,m16,m17,m18,m19,m20,m21,m22,m23,m24] [b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16,b17,b18,b19,b20,b21,b22,b23,b24]- = (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16,d17,d18,d19,d20,d21,d22,d23,d24)- where- !d1 = fromRawBytes (mcdTypeInfo m1) b1- !d2 = fromRawBytes (mcdTypeInfo m2) b2- !d3 = fromRawBytes (mcdTypeInfo m3) b3- !d4 = fromRawBytes (mcdTypeInfo m4) b4- !d5 = fromRawBytes (mcdTypeInfo m5) b5- !d6 = fromRawBytes (mcdTypeInfo m6) b6- !d7 = fromRawBytes (mcdTypeInfo m7) b7- !d8 = fromRawBytes (mcdTypeInfo m8) b8- !d9 = fromRawBytes (mcdTypeInfo m9) b9- !d10 = fromRawBytes (mcdTypeInfo m10) b10- !d11 = fromRawBytes (mcdTypeInfo m11) b11- !d12 = fromRawBytes (mcdTypeInfo m12) b12- !d13 = fromRawBytes (mcdTypeInfo m13) b13- !d14 = fromRawBytes (mcdTypeInfo m14) b14- !d15 = fromRawBytes (mcdTypeInfo m15) b15- !d16 = fromRawBytes (mcdTypeInfo m16) b16- !d17 = fromRawBytes (mcdTypeInfo m17) b17- !d18 = fromRawBytes (mcdTypeInfo m18) b18- !d19 = fromRawBytes (mcdTypeInfo m19) b19- !d20 = fromRawBytes (mcdTypeInfo m20) b20- !d21 = fromRawBytes (mcdTypeInfo m21) b21- !d22 = fromRawBytes (mcdTypeInfo m22) b22- !d23 = fromRawBytes (mcdTypeInfo m23) b23- !d24 = fromRawBytes (mcdTypeInfo m24) b24- fromListOfRawBytes _ _ = error "fromListOfRawBytes: List length must be 24"--instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m, Data n, Data o, Data p, Data q, Data r, Data s- , Data t, Data u, Data v, Data w, Data x, Data y) =>- Row (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y) where- fromListOfRawBytes [m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m14,m15,m16,m17,m18,m19,m20,m21,m22,m23,m24,m25] [b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16,b17,b18,b19,b20,b21,b22,b23,b24,b25]- = (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16,d17,d18,d19,d20,d21,d22,d23,d24,d25)- where- !d1 = fromRawBytes (mcdTypeInfo m1) b1- !d2 = fromRawBytes (mcdTypeInfo m2) b2- !d3 = fromRawBytes (mcdTypeInfo m3) b3- !d4 = fromRawBytes (mcdTypeInfo m4) b4- !d5 = fromRawBytes (mcdTypeInfo m5) b5- !d6 = fromRawBytes (mcdTypeInfo m6) b6- !d7 = fromRawBytes (mcdTypeInfo m7) b7- !d8 = fromRawBytes (mcdTypeInfo m8) b8- !d9 = fromRawBytes (mcdTypeInfo m9) b9- !d10 = fromRawBytes (mcdTypeInfo m10) b10- !d11 = fromRawBytes (mcdTypeInfo m11) b11- !d12 = fromRawBytes (mcdTypeInfo m12) b12- !d13 = fromRawBytes (mcdTypeInfo m13) b13- !d14 = fromRawBytes (mcdTypeInfo m14) b14- !d15 = fromRawBytes (mcdTypeInfo m15) b15- !d16 = fromRawBytes (mcdTypeInfo m16) b16- !d17 = fromRawBytes (mcdTypeInfo m17) b17- !d18 = fromRawBytes (mcdTypeInfo m18) b18- !d19 = fromRawBytes (mcdTypeInfo m19) b19- !d20 = fromRawBytes (mcdTypeInfo m20) b20- !d21 = fromRawBytes (mcdTypeInfo m21) b21- !d22 = fromRawBytes (mcdTypeInfo m22) b22- !d23 = fromRawBytes (mcdTypeInfo m23) b23- !d24 = fromRawBytes (mcdTypeInfo m24) b24- !d25 = fromRawBytes (mcdTypeInfo m25) b25- fromListOfRawBytes _ _ = error "fromListOfRawBytes: List length must be 25"--instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m, Data n, Data o, Data p, Data q, Data r, Data s- , Data t, Data u, Data v, Data w, Data x, Data y, Data z) =>- Row (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z) where- fromListOfRawBytes [m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m14,m15,m16,m17,m18,m19,m20,m21,m22,m23,m24,m25,m26] [b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16,b17,b18,b19,b20,b21,b22,b23,b24,b25,b26]- = (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16,d17,d18,d19,d20,d21,d22,d23,d24,d25,d26)- where- !d1 = fromRawBytes (mcdTypeInfo m1) b1- !d2 = fromRawBytes (mcdTypeInfo m2) b2- !d3 = fromRawBytes (mcdTypeInfo m3) b3- !d4 = fromRawBytes (mcdTypeInfo m4) b4- !d5 = fromRawBytes (mcdTypeInfo m5) b5- !d6 = fromRawBytes (mcdTypeInfo m6) b6- !d7 = fromRawBytes (mcdTypeInfo m7) b7- !d8 = fromRawBytes (mcdTypeInfo m8) b8- !d9 = fromRawBytes (mcdTypeInfo m9) b9- !d10 = fromRawBytes (mcdTypeInfo m10) b10- !d11 = fromRawBytes (mcdTypeInfo m11) b11- !d12 = fromRawBytes (mcdTypeInfo m12) b12- !d13 = fromRawBytes (mcdTypeInfo m13) b13- !d14 = fromRawBytes (mcdTypeInfo m14) b14- !d15 = fromRawBytes (mcdTypeInfo m15) b15- !d16 = fromRawBytes (mcdTypeInfo m16) b16- !d17 = fromRawBytes (mcdTypeInfo m17) b17- !d18 = fromRawBytes (mcdTypeInfo m18) b18- !d19 = fromRawBytes (mcdTypeInfo m19) b19- !d20 = fromRawBytes (mcdTypeInfo m20) b20- !d21 = fromRawBytes (mcdTypeInfo m21) b21- !d22 = fromRawBytes (mcdTypeInfo m22) b22- !d23 = fromRawBytes (mcdTypeInfo m23) b23- !d24 = fromRawBytes (mcdTypeInfo m24) b24- !d25 = fromRawBytes (mcdTypeInfo m25) b25- !d26 = fromRawBytes (mcdTypeInfo m26) b26- fromListOfRawBytes _ _ = error "fromListOfRawBytes: List length must be 26"--+-- [MEMO] using Template Haskell+forM [2..30] $ \n -> do+ dec <- rowTupleQ n+-- runIO $ putStrLn $ pprint dec+ return dec+--instance (Data a1, Data a2) => Row (a1,a2) where+-- fromListOfRawBytes [m1,m2] [b1,b2] = (d1,d2)+-- where+-- !d1 = fromRawBytes (mcdTypeInfo m1) b1+-- !d2 = fromRawBytes (mcdTypeInfo m2) b2+-- fromListOfRawBytes _ _ = error "fromListOfRawBytes: List length must be 2"+--
src/Database/MSSQLServer/Query/RpcQuerySet.hs view
@@ -1,6 +1,7 @@ {-# OPTIONS_HADDOCK hide #-} {-# LANGUAGE BangPatterns #-} {-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE TemplateHaskell #-} module Database.MSSQLServer.Query.RpcQuerySet ( RpcQuerySet (..)@@ -19,50 +20,10 @@ import Database.Tds.Message import Database.MSSQLServer.Query.Only----class RpcQuerySet a where- toRpcRequest :: a -> RpcRequest---- [TODO] use Template Haskell-instance (RpcQueryId a1, RpcParamSet b1) => RpcQuerySet (RpcQuery a1 b1) where- toRpcRequest (RpcQuery a1 b1) = RpcRequest [r1]- where- !r1 = toRpcReqBatch a1 b1--instance (RpcQueryId a1, RpcParamSet b1, RpcQueryId a2, RpcParamSet b2) => RpcQuerySet (RpcQuery a1 b1, RpcQuery a2 b2) where- toRpcRequest (RpcQuery a1 b1,RpcQuery a2 b2) = RpcRequest [r1,r2]- where- !r1 = toRpcReqBatch a1 b1- !r2 = toRpcReqBatch a2 b2--instance (RpcQueryId a1, RpcParamSet b1, RpcQueryId a2, RpcParamSet b2, RpcQueryId a3, RpcParamSet b3) => RpcQuerySet (RpcQuery a1 b1, RpcQuery a2 b2, RpcQuery a3 b3) where- toRpcRequest (RpcQuery a1 b1,RpcQuery a2 b2,RpcQuery a3 b3) = RpcRequest [r1,r2,r3]- where- !r1 = toRpcReqBatch a1 b1- !r2 = toRpcReqBatch a2 b2- !r3 = toRpcReqBatch a3 b3--instance (RpcQueryId a1, RpcParamSet b1, RpcQueryId a2, RpcParamSet b2, RpcQueryId a3, RpcParamSet b3, RpcQueryId a4, RpcParamSet b4) =>- RpcQuerySet (RpcQuery a1 b1, RpcQuery a2 b2, RpcQuery a3 b3, RpcQuery a4 b4) where- toRpcRequest (RpcQuery a1 b1,RpcQuery a2 b2,RpcQuery a3 b3,RpcQuery a4 b4) = RpcRequest [r1,r2,r3,r4]- where- !r1 = toRpcReqBatch a1 b1- !r2 = toRpcReqBatch a2 b2- !r3 = toRpcReqBatch a3 b3- !r4 = toRpcReqBatch a4 b4--instance (RpcQueryId a1, RpcParamSet b1, RpcQueryId a2, RpcParamSet b2, RpcQueryId a3, RpcParamSet b3, RpcQueryId a4, RpcParamSet b4, RpcQueryId a5, RpcParamSet b5) =>- RpcQuerySet (RpcQuery a1 b1, RpcQuery a2 b2, RpcQuery a3 b3, RpcQuery a4 b4, RpcQuery a5 b5) where- toRpcRequest (RpcQuery a1 b1,RpcQuery a2 b2,RpcQuery a3 b3,RpcQuery a4 b4,RpcQuery a5 b5) = RpcRequest [r1,r2,r3,r4,r5]- where- !r1 = toRpcReqBatch a1 b1- !r2 = toRpcReqBatch a2 b2- !r3 = toRpcReqBatch a3 b3- !r4 = toRpcReqBatch a4 b4- !r5 = toRpcReqBatch a5 b5+import Database.MSSQLServer.Query.Template +import Control.Monad(forM)+import Language.Haskell.TH (runIO,pprint) data RpcQuery a b = RpcQuery a b@@ -98,110 +59,6 @@ toRpcReqBatch sp ps = RpcReqBatchProcId (fromIntegral $ (fromEnum sp) +1) 0x0000 $ toRpcReqBatchParams ps -class RpcParamSet a where- toRpcReqBatchParams :: a -> [RpcReqBatchParam]- -instance RpcParamSet () where- toRpcReqBatchParams _ = []---- [TODO] use Template Haskell-instance (Data a) => RpcParamSet (RpcParam a) where- toRpcReqBatchParams v1 = [b1]- where- !b1 = rpcReqBatchParam v1--instance (Data a, Data b) => RpcParamSet (RpcParam a, RpcParam b) where- toRpcReqBatchParams (v1,v2) = [b1,b2]- where- !b1 = rpcReqBatchParam v1- !b2 = rpcReqBatchParam v2--instance (Data a, Data b, Data c) => RpcParamSet (RpcParam a, RpcParam b, RpcParam c) where- toRpcReqBatchParams (v1,v2,v3) = [b1,b2,b3]- where- !b1 = rpcReqBatchParam v1- !b2 = rpcReqBatchParam v2- !b3 = rpcReqBatchParam v3--instance (Data a, Data b, Data c, Data d) => RpcParamSet (RpcParam a, RpcParam b, RpcParam c, RpcParam d) where- toRpcReqBatchParams (v1,v2,v3,v4) = [b1,b2,b3,b4]- where- !b1 = rpcReqBatchParam v1- !b2 = rpcReqBatchParam v2- !b3 = rpcReqBatchParam v3- !b4 = rpcReqBatchParam v4--instance (Data a, Data b, Data c, Data d, Data e) => RpcParamSet (RpcParam a, RpcParam b, RpcParam c, RpcParam d, RpcParam e) where- toRpcReqBatchParams (v1,v2,v3,v4,v5) = [b1,b2,b3,b4,b5]- where- !b1 = rpcReqBatchParam v1- !b2 = rpcReqBatchParam v2- !b3 = rpcReqBatchParam v3- !b4 = rpcReqBatchParam v4- !b5 = rpcReqBatchParam v5--instance (Data a, Data b, Data c, Data d, Data e, Data f) => RpcParamSet (RpcParam a, RpcParam b, RpcParam c, RpcParam d, RpcParam e, RpcParam f) where- toRpcReqBatchParams (v1,v2,v3,v4,v5,v6) = [b1,b2,b3,b4,b5,b6]- where- !b1 = rpcReqBatchParam v1- !b2 = rpcReqBatchParam v2- !b3 = rpcReqBatchParam v3- !b4 = rpcReqBatchParam v4- !b5 = rpcReqBatchParam v5- !b6 = rpcReqBatchParam v6--instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g) => RpcParamSet (RpcParam a, RpcParam b, RpcParam c, RpcParam d, RpcParam e, RpcParam f, RpcParam g) where- toRpcReqBatchParams (v1,v2,v3,v4,v5,v6,v7) = [b1,b2,b3,b4,b5,b6,b7]- where- !b1 = rpcReqBatchParam v1- !b2 = rpcReqBatchParam v2- !b3 = rpcReqBatchParam v3- !b4 = rpcReqBatchParam v4- !b5 = rpcReqBatchParam v5- !b6 = rpcReqBatchParam v6- !b7 = rpcReqBatchParam v7--instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h) => RpcParamSet (RpcParam a, RpcParam b, RpcParam c, RpcParam d, RpcParam e, RpcParam f, RpcParam g, RpcParam h) where- toRpcReqBatchParams (v1,v2,v3,v4,v5,v6,v7,v8) = [b1,b2,b3,b4,b5,b6,b7,b8]- where- !b1 = rpcReqBatchParam v1- !b2 = rpcReqBatchParam v2- !b3 = rpcReqBatchParam v3- !b4 = rpcReqBatchParam v4- !b5 = rpcReqBatchParam v5- !b6 = rpcReqBatchParam v6- !b7 = rpcReqBatchParam v7- !b8 = rpcReqBatchParam v8--instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i) => RpcParamSet (RpcParam a, RpcParam b, RpcParam c, RpcParam d, RpcParam e, RpcParam f, RpcParam g, RpcParam h, RpcParam i) where- toRpcReqBatchParams (v1,v2,v3,v4,v5,v6,v7,v8,v9) = [b1,b2,b3,b4,b5,b6,b7,b8,b9]- where- !b1 = rpcReqBatchParam v1- !b2 = rpcReqBatchParam v2- !b3 = rpcReqBatchParam v3- !b4 = rpcReqBatchParam v4- !b5 = rpcReqBatchParam v5- !b6 = rpcReqBatchParam v6- !b7 = rpcReqBatchParam v7- !b8 = rpcReqBatchParam v8- !b9 = rpcReqBatchParam v9--instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j) => RpcParamSet (RpcParam a, RpcParam b, RpcParam c, RpcParam d, RpcParam e, RpcParam f, RpcParam g, RpcParam h, RpcParam i, RpcParam j) where- toRpcReqBatchParams (v1,v2,v3,v4,v5,v6,v7,v8,v9,v10) = [b1,b2,b3,b4,b5,b6,b7,b8,b9,b10]- where- !b1 = rpcReqBatchParam v1- !b2 = rpcReqBatchParam v2- !b3 = rpcReqBatchParam v3- !b4 = rpcReqBatchParam v4- !b5 = rpcReqBatchParam v5- !b6 = rpcReqBatchParam v6- !b7 = rpcReqBatchParam v7- !b8 = rpcReqBatchParam v8- !b9 = rpcReqBatchParam v9- !b10 = rpcReqBatchParam v10--- type RpcParamName = T.Text data RpcParam a = RpcParamVal RpcParamName TypeInfo a@@ -221,3 +78,49 @@ f (RpcParamDefRef name ti dt) = RpcReqBatchParam name 3 ti (toRawBytes ti dt) ++class RpcParamSet a where+ toRpcReqBatchParams :: a -> [RpcReqBatchParam]++instance RpcParamSet () where+ toRpcReqBatchParams _ = []++instance (Data a) => RpcParamSet (RpcParam a) where+ toRpcReqBatchParams v1 = [b1]+ where+ !b1 = rpcReqBatchParam v1++-- [MEMO] using Template Haskell+forM [2..30] $ \n -> do+ dec <- rpcParamSetTupleQ n+-- runIO $ putStrLn $ pprint dec+ return dec+--instance (Data a1, Data a2) => RpcParamSet (RpcParam a1, RpcParam a2) where+-- toRpcReqBatchParams (d1,d2) = [p1,bp]+-- where+-- !p1 = rpcReqBatchParam d1+-- !p2 = rpcReqBatchParam d2+--+++++class RpcQuerySet a where+ toRpcRequest :: a -> RpcRequest++instance (RpcQueryId a1, RpcParamSet b1) => RpcQuerySet (RpcQuery a1 b1) where+ toRpcRequest (RpcQuery a1 b1) = RpcRequest [r1]+ where+ !r1 = toRpcReqBatch a1 b1++-- [MEMO] using Template Haskell+forM [2..30] $ \n -> do+ dec <- rpcQuerySetTupleQ n+-- runIO $ putStrLn $ pprint dec+ return dec+--instance (RpcQueryId a1, RpcParamSet b1, RpcQueryId a2, RpcParamSet b2) => RpcQuerySet (RpcQuery a1 b1, RpcQuery a2 b2) where+-- toRpcRequest (RpcQuery a1 b1,RpcQuery a2 b2) = RpcRequest [r1,r2]+-- where+-- !r1 = toRpcReqBatch a1 b1+-- !r2 = toRpcReqBatch a2 b2+--
src/Database/MSSQLServer/Query/RpcResponseSet.hs view
@@ -1,6 +1,7 @@ {-# OPTIONS_HADDOCK hide #-} {-# LANGUAGE BangPatterns #-} {-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE TemplateHaskell #-} module Database.MSSQLServer.Query.RpcResponseSet ( RpcResponseSet (..) , RpcResponse (..)@@ -14,81 +15,14 @@ import Database.MSSQLServer.Query.Row import Database.MSSQLServer.Query.Only import Database.MSSQLServer.Query.TokenStreamParser+import Database.MSSQLServer.Query.Template +import Control.Monad(forM)+import Language.Haskell.TH (runIO,pprint) -class RpcResponseSet a where- rpcResponseSetParser :: Parser a --- [TODO] use Template Haskell-instance (RpcOutputSet a1, RpcResultSet b1) => RpcResponseSet (RpcResponse a1 b1) where- rpcResponseSetParser = rpcResponseParser--instance (RpcOutputSet a1, RpcResultSet b1, RpcOutputSet a2, RpcResultSet b2) => RpcResponseSet (RpcResponse a1 b1, RpcResponse a2 b2) where- rpcResponseSetParser = do- !b1 <- rpcResponseParser- !b2 <- rpcResponseParser- return (b1,b2)--instance (RpcOutputSet a1, RpcResultSet b1, RpcOutputSet a2, RpcResultSet b2, RpcOutputSet a3, RpcResultSet b3) => RpcResponseSet (RpcResponse a1 b1, RpcResponse a2 b2, RpcResponse a3 b3) where- rpcResponseSetParser = do- !b1 <- rpcResponseParser- !b2 <- rpcResponseParser- !b3 <- rpcResponseParser- return (b1,b2,b3)--instance (RpcOutputSet a1, RpcResultSet b1, RpcOutputSet a2, RpcResultSet b2, RpcOutputSet a3, RpcResultSet b3, RpcOutputSet a4, RpcResultSet b4) => RpcResponseSet (RpcResponse a1 b1, RpcResponse a2 b2, RpcResponse a3 b3, RpcResponse a4 b4) where- rpcResponseSetParser = do- !b1 <- rpcResponseParser- !b2 <- rpcResponseParser- !b3 <- rpcResponseParser- !b4 <- rpcResponseParser- return (b1,b2,b3,b4)--instance (RpcOutputSet a1, RpcResultSet b1, RpcOutputSet a2, RpcResultSet b2, RpcOutputSet a3, RpcResultSet b3, RpcOutputSet a4, RpcResultSet b4, RpcOutputSet a5, RpcResultSet b5) => RpcResponseSet (RpcResponse a1 b1, RpcResponse a2 b2, RpcResponse a3 b3, RpcResponse a4 b4, RpcResponse a5 b5) where- rpcResponseSetParser = do- !b1 <- rpcResponseParser- !b2 <- rpcResponseParser- !b3 <- rpcResponseParser- !b4 <- rpcResponseParser- !b5 <- rpcResponseParser- return (b1,b2,b3,b4,b5)---- (RpcOutputSet a, RpcResultSet b) => -data RpcResponse a b = RpcResponse Int a b- deriving (Show)---rpcResponseParser :: (RpcOutputSet a, RpcResultSet b) => Parser (RpcResponse a b)-rpcResponseParser = p- where- p = do- rss <- rpcResultSetParser- _ <- many $ satisfy $ not . isTSReturnStatus- TSReturnStatus ret <- satisfy isTSReturnStatus- _ <- many $ satisfy $ not . isTSReturnValue- rvs <- many $ satisfy isTSReturnValue- _ <- many $ satisfy $ not . isTSDoneProc- _ <- satisfy isTSDoneProc-- let rvs' = (\(TSReturnValue rv) -> rv) <$> rvs- return $ RpcResponse (fromIntegral ret) (fromReturnValues rvs') rss-- isTSReturnStatus :: TokenStream -> Bool- isTSReturnStatus (TSReturnStatus{}) = True- isTSReturnStatus _ = False-- isTSReturnValue :: TokenStream -> Bool- isTSReturnValue (TSReturnValue{}) = True- isTSReturnValue _ = False-- isTSDoneProc :: TokenStream -> Bool- isTSDoneProc (TSDoneProc{}) = True- isTSDoneProc _ = False--- class RpcResultSet a where rpcResultSetParser :: Parser a @@ -100,49 +34,17 @@ rpcResultSetParser = listOfRow --- [TODO] use Template Haskell-instance (RpcResult a, RpcResult b) => RpcResultSet (a, b) where- rpcResultSetParser = p- where- p :: (RpcResult a, RpcResult b) => Parser (a, b)- p = do- !r1 <- rpcResultParser :: (RpcResult a) => Parser a- !r2 <- rpcResultParser :: (RpcResult b) => Parser b- return (r1,r2)--instance (RpcResult a, RpcResult b, RpcResult c) => RpcResultSet (a, b, c) where- rpcResultSetParser = p- where- p :: (RpcResult a, RpcResult b, RpcResult c) => Parser (a, b, c)- p = do- !r1 <- rpcResultParser :: (RpcResult a) => Parser a- !r2 <- rpcResultParser :: (RpcResult b) => Parser b- !r3 <- rpcResultParser :: (RpcResult c) => Parser c- return (r1,r2,r3)--instance (RpcResult a, RpcResult b, RpcResult c, RpcResult d) => RpcResultSet (a, b, c, d) where- rpcResultSetParser = p- where- p :: (RpcResult a, RpcResult b, RpcResult c, RpcResult d) => Parser (a, b, c, d)- p = do- !r1 <- rpcResultParser :: (RpcResult a) => Parser a- !r2 <- rpcResultParser :: (RpcResult b) => Parser b- !r3 <- rpcResultParser :: (RpcResult c) => Parser c- !r4 <- rpcResultParser :: (RpcResult d) => Parser d- return (r1,r2,r3,r4)--instance (RpcResult a, RpcResult b, RpcResult c, RpcResult d, RpcResult e) => RpcResultSet (a, b, c, d, e) where- rpcResultSetParser = p- where- p :: (RpcResult a, RpcResult b, RpcResult c, RpcResult d, RpcResult e) => Parser (a, b, c, d, e)- p = do- !r1 <- rpcResultParser :: (RpcResult a) => Parser a- !r2 <- rpcResultParser :: (RpcResult b) => Parser b- !r3 <- rpcResultParser :: (RpcResult c) => Parser c- !r4 <- rpcResultParser :: (RpcResult d) => Parser d- !r5 <- rpcResultParser :: (RpcResult e) => Parser e- return (r1,r2,r3,r4,r5)-+-- [MEMO] using Template Haskell+forM [2..30] $ \n -> do+ dec <- rpcResultSetTupleQ n+-- runIO $ putStrLn $ pprint dec+ return dec+--instance (RpcResult a1, RpcResult a2) => RpcResultSet (a1, a2) where+-- rpcResultSetParser = do+-- !r1 <- rpcResultParser :: (RpcResult a1) => Parser a1+-- !r2 <- rpcResultParser :: (RpcResult a2) => Parser a2+-- return (r1,r2)+-- class RpcResult a where@@ -172,496 +74,77 @@ fromReturnValues [] = () fromReturnValues _ = error "fromReturnValues: List length must be 0" --- [TODO] use Template Haskell instance (Data a) => RpcOutputSet (Only a) where fromReturnValues [r1] = Only d1 where !d1 = fromRawBytes (rvTypeInfo r1) (rvRawBytes r1) fromReturnValues _ = error "fromReturnValues: List length must be 1" -instance (Data a, Data b) => RpcOutputSet (a,b) where- fromReturnValues [r1,r2] = (d1,d2)- where- !d1 = fromRawBytes (rvTypeInfo r1) (rvRawBytes r1)- !d2 = fromRawBytes (rvTypeInfo r2) (rvRawBytes r2)- fromReturnValues _ = error "fromReturnValues: List length must be 2"+-- [MEMO] using Template Haskell+forM [2..30] $ \n -> do+ dec <- rpcOutputSetTupleQ n+-- runIO $ putStrLn $ pprint dec+ return dec+--instance (Data a1, Data a2) => RpcOutputSet (a1,a2) where+-- fromReturnValues [r1,r2] = (d1,d2)+-- where+-- !d1 = fromRawBytes (rvTypeInfo r1) (rvRawBytes r1)+-- !d2 = fromRawBytes (rvTypeInfo r2) (rvRawBytes r2)+-- fromReturnValues _ = error "fromReturnValues: List length must be 2"+-- -instance (Data a, Data b, Data c) => RpcOutputSet (a,b,c) where- fromReturnValues [r1,r2,r3] = (d1,d2,d3)- where- !d1 = fromRawBytes (rvTypeInfo r1) (rvRawBytes r1)- !d2 = fromRawBytes (rvTypeInfo r2) (rvRawBytes r2)- !d3 = fromRawBytes (rvTypeInfo r3) (rvRawBytes r3)- fromReturnValues _ = error "fromReturnValues: List length must be 3" -instance (Data a, Data b, Data c, Data d) => RpcOutputSet (a,b,c,d) where- fromReturnValues [r1,r2,r3,r4] = (d1,d2,d3,d4)- where- !d1 = fromRawBytes (rvTypeInfo r1) (rvRawBytes r1)- !d2 = fromRawBytes (rvTypeInfo r2) (rvRawBytes r2)- !d3 = fromRawBytes (rvTypeInfo r3) (rvRawBytes r3)- !d4 = fromRawBytes (rvTypeInfo r4) (rvRawBytes r4)- fromReturnValues _ = error "fromReturnValues: List length must be 4" -instance (Data a, Data b, Data c, Data d, Data e) => RpcOutputSet (a,b,c,d,e) where- fromReturnValues [r1,r2,r3,r4,r5] = (d1,d2,d3,d4,d5)- where- !d1 = fromRawBytes (rvTypeInfo r1) (rvRawBytes r1)- !d2 = fromRawBytes (rvTypeInfo r2) (rvRawBytes r2)- !d3 = fromRawBytes (rvTypeInfo r3) (rvRawBytes r3)- !d4 = fromRawBytes (rvTypeInfo r4) (rvRawBytes r4)- !d5 = fromRawBytes (rvTypeInfo r5) (rvRawBytes r5)- fromReturnValues _ = error "fromReturnValues: List length must be 5"+-- (RpcOutputSet a, RpcResultSet b) => +data RpcResponse a b = RpcResponse Int a b+ deriving (Show) -instance (Data a, Data b, Data c, Data d, Data e, Data f) => RpcOutputSet (a,b,c,d,e,f) where- fromReturnValues [r1,r2,r3,r4,r5,r6] = (d1,d2,d3,d4,d5,d6)- where- !d1 = fromRawBytes (rvTypeInfo r1) (rvRawBytes r1)- !d2 = fromRawBytes (rvTypeInfo r2) (rvRawBytes r2)- !d3 = fromRawBytes (rvTypeInfo r3) (rvRawBytes r3)- !d4 = fromRawBytes (rvTypeInfo r4) (rvRawBytes r4)- !d5 = fromRawBytes (rvTypeInfo r5) (rvRawBytes r5)- !d6 = fromRawBytes (rvTypeInfo r6) (rvRawBytes r6)- fromReturnValues _ = error "fromReturnValues: List length must be 6" -instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g) => RpcOutputSet (a,b,c,d,e,f,g) where- fromReturnValues [r1,r2,r3,r4,r5,r6,r7] = (d1,d2,d3,d4,d5,d6,d7)- where- !d1 = fromRawBytes (rvTypeInfo r1) (rvRawBytes r1)- !d2 = fromRawBytes (rvTypeInfo r2) (rvRawBytes r2)- !d3 = fromRawBytes (rvTypeInfo r3) (rvRawBytes r3)- !d4 = fromRawBytes (rvTypeInfo r4) (rvRawBytes r4)- !d5 = fromRawBytes (rvTypeInfo r5) (rvRawBytes r5)- !d6 = fromRawBytes (rvTypeInfo r6) (rvRawBytes r6)- !d7 = fromRawBytes (rvTypeInfo r7) (rvRawBytes r7)- fromReturnValues _ = error "fromReturnValues: List length must be 7"+rpcResponseParser :: (RpcOutputSet a, RpcResultSet b) => Parser (RpcResponse a b)+rpcResponseParser = p+ where+ p = do+ rss <- rpcResultSetParser+ _ <- many $ satisfy $ not . isTSReturnStatus+ TSReturnStatus ret <- satisfy isTSReturnStatus+ _ <- many $ satisfy $ not . isTSReturnValue+ rvs <- many $ satisfy isTSReturnValue+ _ <- many $ satisfy $ not . isTSDoneProc+ _ <- satisfy isTSDoneProc -instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h) => RpcOutputSet (a,b,c,d,e,f,g,h) where- fromReturnValues [r1,r2,r3,r4,r5,r6,r7,r8] = (d1,d2,d3,d4,d5,d6,d7,d8)- where- !d1 = fromRawBytes (rvTypeInfo r1) (rvRawBytes r1)- !d2 = fromRawBytes (rvTypeInfo r2) (rvRawBytes r2)- !d3 = fromRawBytes (rvTypeInfo r3) (rvRawBytes r3)- !d4 = fromRawBytes (rvTypeInfo r4) (rvRawBytes r4)- !d5 = fromRawBytes (rvTypeInfo r5) (rvRawBytes r5)- !d6 = fromRawBytes (rvTypeInfo r6) (rvRawBytes r6)- !d7 = fromRawBytes (rvTypeInfo r7) (rvRawBytes r7)- !d8 = fromRawBytes (rvTypeInfo r8) (rvRawBytes r8)- fromReturnValues _ = error "fromReturnValues: List length must be 8"+ let rvs' = (\(TSReturnValue rv) -> rv) <$> rvs+ return $ RpcResponse (fromIntegral ret) (fromReturnValues rvs') rss -instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i) => RpcOutputSet (a,b,c,d,e,f,g,h,i) where- fromReturnValues [r1,r2,r3,r4,r5,r6,r7,r8,r9] = (d1,d2,d3,d4,d5,d6,d7,d8,d9)- where- !d1 = fromRawBytes (rvTypeInfo r1) (rvRawBytes r1)- !d2 = fromRawBytes (rvTypeInfo r2) (rvRawBytes r2)- !d3 = fromRawBytes (rvTypeInfo r3) (rvRawBytes r3)- !d4 = fromRawBytes (rvTypeInfo r4) (rvRawBytes r4)- !d5 = fromRawBytes (rvTypeInfo r5) (rvRawBytes r5)- !d6 = fromRawBytes (rvTypeInfo r6) (rvRawBytes r6)- !d7 = fromRawBytes (rvTypeInfo r7) (rvRawBytes r7)- !d8 = fromRawBytes (rvTypeInfo r8) (rvRawBytes r8)- !d9 = fromRawBytes (rvTypeInfo r9) (rvRawBytes r9)- fromReturnValues _ = error "fromReturnValues: List length must be 9"+ isTSReturnStatus :: TokenStream -> Bool+ isTSReturnStatus (TSReturnStatus{}) = True+ isTSReturnStatus _ = False -instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j) => RpcOutputSet (a,b,c,d,e,f,g,h,i,j) where- fromReturnValues [r1,r2,r3,r4,r5,r6,r7,r8,r9,r10] = (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10)- where- !d1 = fromRawBytes (rvTypeInfo r1) (rvRawBytes r1)- !d2 = fromRawBytes (rvTypeInfo r2) (rvRawBytes r2)- !d3 = fromRawBytes (rvTypeInfo r3) (rvRawBytes r3)- !d4 = fromRawBytes (rvTypeInfo r4) (rvRawBytes r4)- !d5 = fromRawBytes (rvTypeInfo r5) (rvRawBytes r5)- !d6 = fromRawBytes (rvTypeInfo r6) (rvRawBytes r6)- !d7 = fromRawBytes (rvTypeInfo r7) (rvRawBytes r7)- !d8 = fromRawBytes (rvTypeInfo r8) (rvRawBytes r8)- !d9 = fromRawBytes (rvTypeInfo r9) (rvRawBytes r9)- !d10 = fromRawBytes (rvTypeInfo r10) (rvRawBytes r10)- fromReturnValues _ = error "fromReturnValues: List length must be 10"+ isTSReturnValue :: TokenStream -> Bool+ isTSReturnValue (TSReturnValue{}) = True+ isTSReturnValue _ = False -instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k) => RpcOutputSet (a,b,c,d,e,f,g,h,i,j,k) where- fromReturnValues [r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11] = (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11)- where- !d1 = fromRawBytes (rvTypeInfo r1) (rvRawBytes r1)- !d2 = fromRawBytes (rvTypeInfo r2) (rvRawBytes r2)- !d3 = fromRawBytes (rvTypeInfo r3) (rvRawBytes r3)- !d4 = fromRawBytes (rvTypeInfo r4) (rvRawBytes r4)- !d5 = fromRawBytes (rvTypeInfo r5) (rvRawBytes r5)- !d6 = fromRawBytes (rvTypeInfo r6) (rvRawBytes r6)- !d7 = fromRawBytes (rvTypeInfo r7) (rvRawBytes r7)- !d8 = fromRawBytes (rvTypeInfo r8) (rvRawBytes r8)- !d9 = fromRawBytes (rvTypeInfo r9) (rvRawBytes r9)- !d10 = fromRawBytes (rvTypeInfo r10) (rvRawBytes r10)- !d11 = fromRawBytes (rvTypeInfo r11) (rvRawBytes r11)- fromReturnValues _ = error "fromReturnValues: List length must be 11"+ isTSDoneProc :: TokenStream -> Bool+ isTSDoneProc (TSDoneProc{}) = True+ isTSDoneProc _ = False -instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l) => RpcOutputSet (a,b,c,d,e,f,g,h,i,j,k,l) where- fromReturnValues [r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12] = (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12)- where- !d1 = fromRawBytes (rvTypeInfo r1) (rvRawBytes r1)- !d2 = fromRawBytes (rvTypeInfo r2) (rvRawBytes r2)- !d3 = fromRawBytes (rvTypeInfo r3) (rvRawBytes r3)- !d4 = fromRawBytes (rvTypeInfo r4) (rvRawBytes r4)- !d5 = fromRawBytes (rvTypeInfo r5) (rvRawBytes r5)- !d6 = fromRawBytes (rvTypeInfo r6) (rvRawBytes r6)- !d7 = fromRawBytes (rvTypeInfo r7) (rvRawBytes r7)- !d8 = fromRawBytes (rvTypeInfo r8) (rvRawBytes r8)- !d9 = fromRawBytes (rvTypeInfo r9) (rvRawBytes r9)- !d10 = fromRawBytes (rvTypeInfo r10) (rvRawBytes r10)- !d11 = fromRawBytes (rvTypeInfo r11) (rvRawBytes r11)- !d12 = fromRawBytes (rvTypeInfo r12) (rvRawBytes r12)- fromReturnValues _ = error "fromReturnValues: List length must be 12" -instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m) => RpcOutputSet (a,b,c,d,e,f,g,h,i,j,k,l,m) where- fromReturnValues [r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13] = (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13)- where- !d1 = fromRawBytes (rvTypeInfo r1) (rvRawBytes r1)- !d2 = fromRawBytes (rvTypeInfo r2) (rvRawBytes r2)- !d3 = fromRawBytes (rvTypeInfo r3) (rvRawBytes r3)- !d4 = fromRawBytes (rvTypeInfo r4) (rvRawBytes r4)- !d5 = fromRawBytes (rvTypeInfo r5) (rvRawBytes r5)- !d6 = fromRawBytes (rvTypeInfo r6) (rvRawBytes r6)- !d7 = fromRawBytes (rvTypeInfo r7) (rvRawBytes r7)- !d8 = fromRawBytes (rvTypeInfo r8) (rvRawBytes r8)- !d9 = fromRawBytes (rvTypeInfo r9) (rvRawBytes r9)- !d10 = fromRawBytes (rvTypeInfo r10) (rvRawBytes r10)- !d11 = fromRawBytes (rvTypeInfo r11) (rvRawBytes r11)- !d12 = fromRawBytes (rvTypeInfo r12) (rvRawBytes r12)- !d13 = fromRawBytes (rvTypeInfo r13) (rvRawBytes r13)- fromReturnValues _ = error "fromReturnValues: List length must be 13" -instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m, Data n) => RpcOutputSet (a,b,c,d,e,f,g,h,i,j,k,l,m,n) where- fromReturnValues [r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14] = (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14)- where- !d1 = fromRawBytes (rvTypeInfo r1) (rvRawBytes r1)- !d2 = fromRawBytes (rvTypeInfo r2) (rvRawBytes r2)- !d3 = fromRawBytes (rvTypeInfo r3) (rvRawBytes r3)- !d4 = fromRawBytes (rvTypeInfo r4) (rvRawBytes r4)- !d5 = fromRawBytes (rvTypeInfo r5) (rvRawBytes r5)- !d6 = fromRawBytes (rvTypeInfo r6) (rvRawBytes r6)- !d7 = fromRawBytes (rvTypeInfo r7) (rvRawBytes r7)- !d8 = fromRawBytes (rvTypeInfo r8) (rvRawBytes r8)- !d9 = fromRawBytes (rvTypeInfo r9) (rvRawBytes r9)- !d10 = fromRawBytes (rvTypeInfo r10) (rvRawBytes r10)- !d11 = fromRawBytes (rvTypeInfo r11) (rvRawBytes r11)- !d12 = fromRawBytes (rvTypeInfo r12) (rvRawBytes r12)- !d13 = fromRawBytes (rvTypeInfo r13) (rvRawBytes r13)- !d14 = fromRawBytes (rvTypeInfo r14) (rvRawBytes r14)- fromReturnValues _ = error "fromReturnValues: List length must be 14"--instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m, Data n, Data o) => RpcOutputSet (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) where- fromReturnValues [r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15] = (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15)- where- !d1 = fromRawBytes (rvTypeInfo r1) (rvRawBytes r1)- !d2 = fromRawBytes (rvTypeInfo r2) (rvRawBytes r2)- !d3 = fromRawBytes (rvTypeInfo r3) (rvRawBytes r3)- !d4 = fromRawBytes (rvTypeInfo r4) (rvRawBytes r4)- !d5 = fromRawBytes (rvTypeInfo r5) (rvRawBytes r5)- !d6 = fromRawBytes (rvTypeInfo r6) (rvRawBytes r6)- !d7 = fromRawBytes (rvTypeInfo r7) (rvRawBytes r7)- !d8 = fromRawBytes (rvTypeInfo r8) (rvRawBytes r8)- !d9 = fromRawBytes (rvTypeInfo r9) (rvRawBytes r9)- !d10 = fromRawBytes (rvTypeInfo r10) (rvRawBytes r10)- !d11 = fromRawBytes (rvTypeInfo r11) (rvRawBytes r11)- !d12 = fromRawBytes (rvTypeInfo r12) (rvRawBytes r12)- !d13 = fromRawBytes (rvTypeInfo r13) (rvRawBytes r13)- !d14 = fromRawBytes (rvTypeInfo r14) (rvRawBytes r14)- !d15 = fromRawBytes (rvTypeInfo r15) (rvRawBytes r15)- fromReturnValues _ = error "fromReturnValues: List length must be 15"--instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m, Data n, Data o, Data p) => RpcOutputSet (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) where- fromReturnValues [r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,r16]- = (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16)- where- !d1 = fromRawBytes (rvTypeInfo r1) (rvRawBytes r1)- !d2 = fromRawBytes (rvTypeInfo r2) (rvRawBytes r2)- !d3 = fromRawBytes (rvTypeInfo r3) (rvRawBytes r3)- !d4 = fromRawBytes (rvTypeInfo r4) (rvRawBytes r4)- !d5 = fromRawBytes (rvTypeInfo r5) (rvRawBytes r5)- !d6 = fromRawBytes (rvTypeInfo r6) (rvRawBytes r6)- !d7 = fromRawBytes (rvTypeInfo r7) (rvRawBytes r7)- !d8 = fromRawBytes (rvTypeInfo r8) (rvRawBytes r8)- !d9 = fromRawBytes (rvTypeInfo r9) (rvRawBytes r9)- !d10 = fromRawBytes (rvTypeInfo r10) (rvRawBytes r10)- !d11 = fromRawBytes (rvTypeInfo r11) (rvRawBytes r11)- !d12 = fromRawBytes (rvTypeInfo r12) (rvRawBytes r12)- !d13 = fromRawBytes (rvTypeInfo r13) (rvRawBytes r13)- !d14 = fromRawBytes (rvTypeInfo r14) (rvRawBytes r14)- !d15 = fromRawBytes (rvTypeInfo r15) (rvRawBytes r15)- !d16 = fromRawBytes (rvTypeInfo r16) (rvRawBytes r16)- fromReturnValues _ = error "fromReturnValues: List length must be 16"--instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m, Data n, Data o, Data p, Data q) => RpcOutputSet (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) where- fromReturnValues [r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,r16,r17]- = (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16,d17)- where- !d1 = fromRawBytes (rvTypeInfo r1) (rvRawBytes r1)- !d2 = fromRawBytes (rvTypeInfo r2) (rvRawBytes r2)- !d3 = fromRawBytes (rvTypeInfo r3) (rvRawBytes r3)- !d4 = fromRawBytes (rvTypeInfo r4) (rvRawBytes r4)- !d5 = fromRawBytes (rvTypeInfo r5) (rvRawBytes r5)- !d6 = fromRawBytes (rvTypeInfo r6) (rvRawBytes r6)- !d7 = fromRawBytes (rvTypeInfo r7) (rvRawBytes r7)- !d8 = fromRawBytes (rvTypeInfo r8) (rvRawBytes r8)- !d9 = fromRawBytes (rvTypeInfo r9) (rvRawBytes r9)- !d10 = fromRawBytes (rvTypeInfo r10) (rvRawBytes r10)- !d11 = fromRawBytes (rvTypeInfo r11) (rvRawBytes r11)- !d12 = fromRawBytes (rvTypeInfo r12) (rvRawBytes r12)- !d13 = fromRawBytes (rvTypeInfo r13) (rvRawBytes r13)- !d14 = fromRawBytes (rvTypeInfo r14) (rvRawBytes r14)- !d15 = fromRawBytes (rvTypeInfo r15) (rvRawBytes r15)- !d16 = fromRawBytes (rvTypeInfo r16) (rvRawBytes r16)- !d17 = fromRawBytes (rvTypeInfo r17) (rvRawBytes r17)- fromReturnValues _ = error "fromReturnValues: List length must be 17"--instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m, Data n, Data o, Data p, Data q, Data r) => RpcOutputSet (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r) where- fromReturnValues [r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,r16,r17,r18]- = (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16,d17,d18)- where- !d1 = fromRawBytes (rvTypeInfo r1) (rvRawBytes r1)- !d2 = fromRawBytes (rvTypeInfo r2) (rvRawBytes r2)- !d3 = fromRawBytes (rvTypeInfo r3) (rvRawBytes r3)- !d4 = fromRawBytes (rvTypeInfo r4) (rvRawBytes r4)- !d5 = fromRawBytes (rvTypeInfo r5) (rvRawBytes r5)- !d6 = fromRawBytes (rvTypeInfo r6) (rvRawBytes r6)- !d7 = fromRawBytes (rvTypeInfo r7) (rvRawBytes r7)- !d8 = fromRawBytes (rvTypeInfo r8) (rvRawBytes r8)- !d9 = fromRawBytes (rvTypeInfo r9) (rvRawBytes r9)- !d10 = fromRawBytes (rvTypeInfo r10) (rvRawBytes r10)- !d11 = fromRawBytes (rvTypeInfo r11) (rvRawBytes r11)- !d12 = fromRawBytes (rvTypeInfo r12) (rvRawBytes r12)- !d13 = fromRawBytes (rvTypeInfo r13) (rvRawBytes r13)- !d14 = fromRawBytes (rvTypeInfo r14) (rvRawBytes r14)- !d15 = fromRawBytes (rvTypeInfo r15) (rvRawBytes r15)- !d16 = fromRawBytes (rvTypeInfo r16) (rvRawBytes r16)- !d17 = fromRawBytes (rvTypeInfo r17) (rvRawBytes r17)- !d18 = fromRawBytes (rvTypeInfo r18) (rvRawBytes r18)- fromReturnValues _ = error "fromReturnValues: List length must be 18"--instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m, Data n, Data o, Data p, Data q, Data r, Data s) => RpcOutputSet (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s) where- fromReturnValues [r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,r16,r17,r18,r19]- = (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16,d17,d18,d19)- where- !d1 = fromRawBytes (rvTypeInfo r1) (rvRawBytes r1)- !d2 = fromRawBytes (rvTypeInfo r2) (rvRawBytes r2)- !d3 = fromRawBytes (rvTypeInfo r3) (rvRawBytes r3)- !d4 = fromRawBytes (rvTypeInfo r4) (rvRawBytes r4)- !d5 = fromRawBytes (rvTypeInfo r5) (rvRawBytes r5)- !d6 = fromRawBytes (rvTypeInfo r6) (rvRawBytes r6)- !d7 = fromRawBytes (rvTypeInfo r7) (rvRawBytes r7)- !d8 = fromRawBytes (rvTypeInfo r8) (rvRawBytes r8)- !d9 = fromRawBytes (rvTypeInfo r9) (rvRawBytes r9)- !d10 = fromRawBytes (rvTypeInfo r10) (rvRawBytes r10)- !d11 = fromRawBytes (rvTypeInfo r11) (rvRawBytes r11)- !d12 = fromRawBytes (rvTypeInfo r12) (rvRawBytes r12)- !d13 = fromRawBytes (rvTypeInfo r13) (rvRawBytes r13)- !d14 = fromRawBytes (rvTypeInfo r14) (rvRawBytes r14)- !d15 = fromRawBytes (rvTypeInfo r15) (rvRawBytes r15)- !d16 = fromRawBytes (rvTypeInfo r16) (rvRawBytes r16)- !d17 = fromRawBytes (rvTypeInfo r17) (rvRawBytes r17)- !d18 = fromRawBytes (rvTypeInfo r18) (rvRawBytes r18)- !d19 = fromRawBytes (rvTypeInfo r19) (rvRawBytes r19)- fromReturnValues _ = error "fromReturnValues: List length must be 19"--instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m, Data n, Data o, Data p, Data q, Data r, Data s, Data t) => RpcOutputSet (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) where- fromReturnValues [r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,r16,r17,r18,r19,r20]- = (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16,d17,d18,d19,d20)- where- !d1 = fromRawBytes (rvTypeInfo r1) (rvRawBytes r1)- !d2 = fromRawBytes (rvTypeInfo r2) (rvRawBytes r2)- !d3 = fromRawBytes (rvTypeInfo r3) (rvRawBytes r3)- !d4 = fromRawBytes (rvTypeInfo r4) (rvRawBytes r4)- !d5 = fromRawBytes (rvTypeInfo r5) (rvRawBytes r5)- !d6 = fromRawBytes (rvTypeInfo r6) (rvRawBytes r6)- !d7 = fromRawBytes (rvTypeInfo r7) (rvRawBytes r7)- !d8 = fromRawBytes (rvTypeInfo r8) (rvRawBytes r8)- !d9 = fromRawBytes (rvTypeInfo r9) (rvRawBytes r9)- !d10 = fromRawBytes (rvTypeInfo r10) (rvRawBytes r10)- !d11 = fromRawBytes (rvTypeInfo r11) (rvRawBytes r11)- !d12 = fromRawBytes (rvTypeInfo r12) (rvRawBytes r12)- !d13 = fromRawBytes (rvTypeInfo r13) (rvRawBytes r13)- !d14 = fromRawBytes (rvTypeInfo r14) (rvRawBytes r14)- !d15 = fromRawBytes (rvTypeInfo r15) (rvRawBytes r15)- !d16 = fromRawBytes (rvTypeInfo r16) (rvRawBytes r16)- !d17 = fromRawBytes (rvTypeInfo r17) (rvRawBytes r17)- !d18 = fromRawBytes (rvTypeInfo r18) (rvRawBytes r18)- !d19 = fromRawBytes (rvTypeInfo r19) (rvRawBytes r19)- !d20 = fromRawBytes (rvTypeInfo r20) (rvRawBytes r20)- fromReturnValues _ = error "fromReturnValues: List length must be 20"--instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m, Data n, Data o, Data p, Data q, Data r, Data s, Data t, Data u) => RpcOutputSet (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u) where- fromReturnValues [r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,r16,r17,r18,r19,r20,r21]- = (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16,d17,d18,d19,d20,d21)- where- !d1 = fromRawBytes (rvTypeInfo r1) (rvRawBytes r1)- !d2 = fromRawBytes (rvTypeInfo r2) (rvRawBytes r2)- !d3 = fromRawBytes (rvTypeInfo r3) (rvRawBytes r3)- !d4 = fromRawBytes (rvTypeInfo r4) (rvRawBytes r4)- !d5 = fromRawBytes (rvTypeInfo r5) (rvRawBytes r5)- !d6 = fromRawBytes (rvTypeInfo r6) (rvRawBytes r6)- !d7 = fromRawBytes (rvTypeInfo r7) (rvRawBytes r7)- !d8 = fromRawBytes (rvTypeInfo r8) (rvRawBytes r8)- !d9 = fromRawBytes (rvTypeInfo r9) (rvRawBytes r9)- !d10 = fromRawBytes (rvTypeInfo r10) (rvRawBytes r10)- !d11 = fromRawBytes (rvTypeInfo r11) (rvRawBytes r11)- !d12 = fromRawBytes (rvTypeInfo r12) (rvRawBytes r12)- !d13 = fromRawBytes (rvTypeInfo r13) (rvRawBytes r13)- !d14 = fromRawBytes (rvTypeInfo r14) (rvRawBytes r14)- !d15 = fromRawBytes (rvTypeInfo r15) (rvRawBytes r15)- !d16 = fromRawBytes (rvTypeInfo r16) (rvRawBytes r16)- !d17 = fromRawBytes (rvTypeInfo r17) (rvRawBytes r17)- !d18 = fromRawBytes (rvTypeInfo r18) (rvRawBytes r18)- !d19 = fromRawBytes (rvTypeInfo r19) (rvRawBytes r19)- !d20 = fromRawBytes (rvTypeInfo r20) (rvRawBytes r20)- !d21 = fromRawBytes (rvTypeInfo r21) (rvRawBytes r21)- fromReturnValues _ = error "fromReturnValues: List length must be 21"--instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m, Data n, Data o, Data p, Data q, Data r, Data s, Data t, Data u, Data v) => RpcOutputSet (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v) where- fromReturnValues [r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,r16,r17,r18,r19,r20,r21,r22]- = (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16,d17,d18,d19,d20,d21,d22)- where- !d1 = fromRawBytes (rvTypeInfo r1) (rvRawBytes r1)- !d2 = fromRawBytes (rvTypeInfo r2) (rvRawBytes r2)- !d3 = fromRawBytes (rvTypeInfo r3) (rvRawBytes r3)- !d4 = fromRawBytes (rvTypeInfo r4) (rvRawBytes r4)- !d5 = fromRawBytes (rvTypeInfo r5) (rvRawBytes r5)- !d6 = fromRawBytes (rvTypeInfo r6) (rvRawBytes r6)- !d7 = fromRawBytes (rvTypeInfo r7) (rvRawBytes r7)- !d8 = fromRawBytes (rvTypeInfo r8) (rvRawBytes r8)- !d9 = fromRawBytes (rvTypeInfo r9) (rvRawBytes r9)- !d10 = fromRawBytes (rvTypeInfo r10) (rvRawBytes r10)- !d11 = fromRawBytes (rvTypeInfo r11) (rvRawBytes r11)- !d12 = fromRawBytes (rvTypeInfo r12) (rvRawBytes r12)- !d13 = fromRawBytes (rvTypeInfo r13) (rvRawBytes r13)- !d14 = fromRawBytes (rvTypeInfo r14) (rvRawBytes r14)- !d15 = fromRawBytes (rvTypeInfo r15) (rvRawBytes r15)- !d16 = fromRawBytes (rvTypeInfo r16) (rvRawBytes r16)- !d17 = fromRawBytes (rvTypeInfo r17) (rvRawBytes r17)- !d18 = fromRawBytes (rvTypeInfo r18) (rvRawBytes r18)- !d19 = fromRawBytes (rvTypeInfo r19) (rvRawBytes r19)- !d20 = fromRawBytes (rvTypeInfo r20) (rvRawBytes r20)- !d21 = fromRawBytes (rvTypeInfo r21) (rvRawBytes r21)- !d22 = fromRawBytes (rvTypeInfo r22) (rvRawBytes r22)- fromReturnValues _ = error "fromReturnValues: List length must be 22"--instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m, Data n, Data o, Data p, Data q, Data r, Data s, Data t, Data u, Data v, Data w) => RpcOutputSet (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w) where- fromReturnValues [r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,r16,r17,r18,r19,r20,r21,r22,r23]- = (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16,d17,d18,d19,d20,d21,d22,d23)- where- !d1 = fromRawBytes (rvTypeInfo r1) (rvRawBytes r1)- !d2 = fromRawBytes (rvTypeInfo r2) (rvRawBytes r2)- !d3 = fromRawBytes (rvTypeInfo r3) (rvRawBytes r3)- !d4 = fromRawBytes (rvTypeInfo r4) (rvRawBytes r4)- !d5 = fromRawBytes (rvTypeInfo r5) (rvRawBytes r5)- !d6 = fromRawBytes (rvTypeInfo r6) (rvRawBytes r6)- !d7 = fromRawBytes (rvTypeInfo r7) (rvRawBytes r7)- !d8 = fromRawBytes (rvTypeInfo r8) (rvRawBytes r8)- !d9 = fromRawBytes (rvTypeInfo r9) (rvRawBytes r9)- !d10 = fromRawBytes (rvTypeInfo r10) (rvRawBytes r10)- !d11 = fromRawBytes (rvTypeInfo r11) (rvRawBytes r11)- !d12 = fromRawBytes (rvTypeInfo r12) (rvRawBytes r12)- !d13 = fromRawBytes (rvTypeInfo r13) (rvRawBytes r13)- !d14 = fromRawBytes (rvTypeInfo r14) (rvRawBytes r14)- !d15 = fromRawBytes (rvTypeInfo r15) (rvRawBytes r15)- !d16 = fromRawBytes (rvTypeInfo r16) (rvRawBytes r16)- !d17 = fromRawBytes (rvTypeInfo r17) (rvRawBytes r17)- !d18 = fromRawBytes (rvTypeInfo r18) (rvRawBytes r18)- !d19 = fromRawBytes (rvTypeInfo r19) (rvRawBytes r19)- !d20 = fromRawBytes (rvTypeInfo r20) (rvRawBytes r20)- !d21 = fromRawBytes (rvTypeInfo r21) (rvRawBytes r21)- !d22 = fromRawBytes (rvTypeInfo r22) (rvRawBytes r22)- !d23 = fromRawBytes (rvTypeInfo r23) (rvRawBytes r23)- fromReturnValues _ = error "fromReturnValues: List length must be 23"+class RpcResponseSet a where+ rpcResponseSetParser :: Parser a -instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m, Data n, Data o, Data p, Data q, Data r, Data s, Data t, Data u, Data v, Data w, Data x) => RpcOutputSet (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x) where- fromReturnValues [r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,r16,r17,r18,r19,r20,r21,r22,r23,r24]- = (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16,d17,d18,d19,d20,d21,d22,d23,d24)- where- !d1 = fromRawBytes (rvTypeInfo r1) (rvRawBytes r1)- !d2 = fromRawBytes (rvTypeInfo r2) (rvRawBytes r2)- !d3 = fromRawBytes (rvTypeInfo r3) (rvRawBytes r3)- !d4 = fromRawBytes (rvTypeInfo r4) (rvRawBytes r4)- !d5 = fromRawBytes (rvTypeInfo r5) (rvRawBytes r5)- !d6 = fromRawBytes (rvTypeInfo r6) (rvRawBytes r6)- !d7 = fromRawBytes (rvTypeInfo r7) (rvRawBytes r7)- !d8 = fromRawBytes (rvTypeInfo r8) (rvRawBytes r8)- !d9 = fromRawBytes (rvTypeInfo r9) (rvRawBytes r9)- !d10 = fromRawBytes (rvTypeInfo r10) (rvRawBytes r10)- !d11 = fromRawBytes (rvTypeInfo r11) (rvRawBytes r11)- !d12 = fromRawBytes (rvTypeInfo r12) (rvRawBytes r12)- !d13 = fromRawBytes (rvTypeInfo r13) (rvRawBytes r13)- !d14 = fromRawBytes (rvTypeInfo r14) (rvRawBytes r14)- !d15 = fromRawBytes (rvTypeInfo r15) (rvRawBytes r15)- !d16 = fromRawBytes (rvTypeInfo r16) (rvRawBytes r16)- !d17 = fromRawBytes (rvTypeInfo r17) (rvRawBytes r17)- !d18 = fromRawBytes (rvTypeInfo r18) (rvRawBytes r18)- !d19 = fromRawBytes (rvTypeInfo r19) (rvRawBytes r19)- !d20 = fromRawBytes (rvTypeInfo r20) (rvRawBytes r20)- !d21 = fromRawBytes (rvTypeInfo r21) (rvRawBytes r21)- !d22 = fromRawBytes (rvTypeInfo r22) (rvRawBytes r22)- !d23 = fromRawBytes (rvTypeInfo r23) (rvRawBytes r23)- !d24 = fromRawBytes (rvTypeInfo r24) (rvRawBytes r24)- fromReturnValues _ = error "fromReturnValues: List length must be 24"+instance (RpcOutputSet a1, RpcResultSet b1) => RpcResponseSet (RpcResponse a1 b1) where+ rpcResponseSetParser = rpcResponseParser -instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m, Data n, Data o, Data p, Data q, Data r, Data s, Data t, Data u, Data v, Data w, Data x, Data y) => RpcOutputSet (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y) where- fromReturnValues [r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,r16,r17,r18,r19,r20,r21,r22,r23,r24,r25]- = (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16,d17,d18,d19,d20,d21,d22,d23,d24,d25)- where- !d1 = fromRawBytes (rvTypeInfo r1) (rvRawBytes r1)- !d2 = fromRawBytes (rvTypeInfo r2) (rvRawBytes r2)- !d3 = fromRawBytes (rvTypeInfo r3) (rvRawBytes r3)- !d4 = fromRawBytes (rvTypeInfo r4) (rvRawBytes r4)- !d5 = fromRawBytes (rvTypeInfo r5) (rvRawBytes r5)- !d6 = fromRawBytes (rvTypeInfo r6) (rvRawBytes r6)- !d7 = fromRawBytes (rvTypeInfo r7) (rvRawBytes r7)- !d8 = fromRawBytes (rvTypeInfo r8) (rvRawBytes r8)- !d9 = fromRawBytes (rvTypeInfo r9) (rvRawBytes r9)- !d10 = fromRawBytes (rvTypeInfo r10) (rvRawBytes r10)- !d11 = fromRawBytes (rvTypeInfo r11) (rvRawBytes r11)- !d12 = fromRawBytes (rvTypeInfo r12) (rvRawBytes r12)- !d13 = fromRawBytes (rvTypeInfo r13) (rvRawBytes r13)- !d14 = fromRawBytes (rvTypeInfo r14) (rvRawBytes r14)- !d15 = fromRawBytes (rvTypeInfo r15) (rvRawBytes r15)- !d16 = fromRawBytes (rvTypeInfo r16) (rvRawBytes r16)- !d17 = fromRawBytes (rvTypeInfo r17) (rvRawBytes r17)- !d18 = fromRawBytes (rvTypeInfo r18) (rvRawBytes r18)- !d19 = fromRawBytes (rvTypeInfo r19) (rvRawBytes r19)- !d20 = fromRawBytes (rvTypeInfo r20) (rvRawBytes r20)- !d21 = fromRawBytes (rvTypeInfo r21) (rvRawBytes r21)- !d22 = fromRawBytes (rvTypeInfo r22) (rvRawBytes r22)- !d23 = fromRawBytes (rvTypeInfo r23) (rvRawBytes r23)- !d24 = fromRawBytes (rvTypeInfo r24) (rvRawBytes r24)- !d25 = fromRawBytes (rvTypeInfo r25) (rvRawBytes r25)- fromReturnValues _ = error "fromReturnValues: List length must be 25"+-- [MEMO] using Template Haskell+forM [2..30] $ \n -> do+ dec <- rpcResponseSetTupleQ n+-- runIO $ putStrLn $ pprint dec+ return dec+--instance (RpcOutputSet a1, RpcResultSet b1, RpcOutputSet a2, RpcResultSet b2) => RpcResponseSet (RpcResponse a1 b1, RpcResponse a2 b2) where+-- rpcResponseSetParser = do+-- !r1 <- rpcResponseParser+-- !r2 <- rpcResponseParser+-- return (r1,r2)+-- -instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m, Data n, Data o, Data p, Data q, Data r, Data s, Data t, Data u, Data v, Data w, Data x, Data y, Data z) => RpcOutputSet (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z) where- fromReturnValues [r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,r16,r17,r18,r19,r20,r21,r22,r23,r24,r25,r26]- = (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16,d17,d18,d19,d20,d21,d22,d23,d24,d25,d26)- where- !d1 = fromRawBytes (rvTypeInfo r1) (rvRawBytes r1)- !d2 = fromRawBytes (rvTypeInfo r2) (rvRawBytes r2)- !d3 = fromRawBytes (rvTypeInfo r3) (rvRawBytes r3)- !d4 = fromRawBytes (rvTypeInfo r4) (rvRawBytes r4)- !d5 = fromRawBytes (rvTypeInfo r5) (rvRawBytes r5)- !d6 = fromRawBytes (rvTypeInfo r6) (rvRawBytes r6)- !d7 = fromRawBytes (rvTypeInfo r7) (rvRawBytes r7)- !d8 = fromRawBytes (rvTypeInfo r8) (rvRawBytes r8)- !d9 = fromRawBytes (rvTypeInfo r9) (rvRawBytes r9)- !d10 = fromRawBytes (rvTypeInfo r10) (rvRawBytes r10)- !d11 = fromRawBytes (rvTypeInfo r11) (rvRawBytes r11)- !d12 = fromRawBytes (rvTypeInfo r12) (rvRawBytes r12)- !d13 = fromRawBytes (rvTypeInfo r13) (rvRawBytes r13)- !d14 = fromRawBytes (rvTypeInfo r14) (rvRawBytes r14)- !d15 = fromRawBytes (rvTypeInfo r15) (rvRawBytes r15)- !d16 = fromRawBytes (rvTypeInfo r16) (rvRawBytes r16)- !d17 = fromRawBytes (rvTypeInfo r17) (rvRawBytes r17)- !d18 = fromRawBytes (rvTypeInfo r18) (rvRawBytes r18)- !d19 = fromRawBytes (rvTypeInfo r19) (rvRawBytes r19)- !d20 = fromRawBytes (rvTypeInfo r20) (rvRawBytes r20)- !d21 = fromRawBytes (rvTypeInfo r21) (rvRawBytes r21)- !d22 = fromRawBytes (rvTypeInfo r22) (rvRawBytes r22)- !d23 = fromRawBytes (rvTypeInfo r23) (rvRawBytes r23)- !d24 = fromRawBytes (rvTypeInfo r24) (rvRawBytes r24)- !d25 = fromRawBytes (rvTypeInfo r25) (rvRawBytes r25)- !d26 = fromRawBytes (rvTypeInfo r26) (rvRawBytes r26)- fromReturnValues _ = error "fromReturnValues: List length must be 26"
+ src/Database/MSSQLServer/Query/Template.hs view
@@ -0,0 +1,291 @@+{-# OPTIONS_HADDOCK hide #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE TemplateHaskell #-}++module Database.MSSQLServer.Query.Template ( rowTupleQ+ , resultSetTupleQ+ , rpcResponseSetTupleQ+ , rpcOutputSetTupleQ+ , rpcResultSetTupleQ+ , rpcQuerySetTupleQ+ , rpcParamSetTupleQ+ ) where++import Data.Monoid((<>))+import Database.Tds.Message+import Language.Haskell.TH+import Language.Haskell.TH.Syntax (returnQ)+import Data.List (foldl')++++rowTupleQ :: Int -> Q Dec+rowTupleQ n = returnQ $ rowTuple n++rowTuple :: Int -> Dec+rowTuple n =+#if MIN_VERSION_template_haskell(2,11,0)+ InstanceD Nothing+#else+ InstanceD+#endif+#if MIN_VERSION_template_haskell(2,10,0)+ (map (\i ->AppT (ConT ''Data) (VarT (mkName $ "a" <> show i))) [1..n])+#else+ (map (\i ->ClassP ''Data [(VarT (mkName $ "a" <> show i))]) [1..n])+#endif+ (AppT (ConT (mkName "Row")) (foldl' (\x i -> AppT x (VarT (mkName ("a" <> show i)))) (TupleT n) [1..n]))+ [FunD (mkName "fromListOfRawBytes")+ [ Clause+ [ ListP (map (\i ->VarP (mkName $ "m" <> show i)) [1..n])+ , ListP (map (\i ->VarP (mkName $ "b" <> show i)) [1..n])+ ]+ (NormalB (TupE (map (\i ->VarE (mkName $ "d" <> show i)) [1..n]) ))+ (map d [1..n])+ , Clause [WildP,WildP] (NormalB (AppE+ (VarE 'error)+ (LitE (StringL ("fromListOfRawBytes: List length must be " <> show n)))+ )+ ) []+ ]+ ]+ where+ d :: Int -> Dec+ d i = ValD (BangP (VarP (mkName $ "d" <> show i)))+ (NormalB (AppE+ (AppE (VarE 'fromRawBytes)+ (AppE (VarE (mkName "mcdTypeInfo")) (VarE (mkName $ "m" <> show i)))+ )+ (VarE (mkName $ "b" <> show i))+ )+ ) []++++resultSetTupleQ :: Int -> Q Dec+resultSetTupleQ n = returnQ $ resultSetTuple n++resultSetTuple :: Int -> Dec+resultSetTuple n =+#if MIN_VERSION_template_haskell(2,11,0)+ InstanceD Nothing+#else+ InstanceD+#endif+#if MIN_VERSION_template_haskell(2,10,0)+ (map (\i->AppT (ConT (mkName "Result")) (VarT (mkName $ "a" <> (show i)))) [1..n])+#else+ (map (\i ->ClassP (mkName "Result") [(VarT (mkName $ "a" <> show i))]) [1..n])+#endif+ (AppT (ConT (mkName "ResultSet")) (foldl' (\x i -> AppT x (VarT (mkName ("a" <> show i)))) (TupleT n) [1..n]))+ [ValD (VarP (mkName "resultSetParser"))+ (NormalB (DoE+ (+ (flip map [1..n] $ \i ->+ BindS+ (BangP (VarP (mkName $ "r" <> show i )))+ (SigE (VarE (mkName "resultParser"))+ (ForallT+ [PlainTV (mkName $ "a" <> show i)]+#if MIN_VERSION_template_haskell(2,10,0)+ [AppT (ConT (mkName "Result")) (VarT (mkName $ "a" <> show i))]+#else+ [ClassP (mkName "Result") [VarT (mkName $ "a" <> show i)]]+#endif+ (AppT (ConT (mkName "Parser")) (VarT (mkName $ "a" <> show i)))+ )+ )+ )+ <>+ [(NoBindS (AppE (VarE 'return) (TupE (map (\i->VarE (mkName $ "r" <> show i)) [1..n]) )) )]+ )+ )+ ) []+ ]++++rpcResponseSetTupleQ :: Int -> Q Dec+rpcResponseSetTupleQ n = returnQ $ rpcResponseSetTuple n++rpcResponseSetTuple :: Int -> Dec+rpcResponseSetTuple n =+#if MIN_VERSION_template_haskell(2,11,0)+ InstanceD Nothing+#else+ InstanceD+#endif+#if MIN_VERSION_template_haskell(2,10,0)+ (concatMap (\i->[AppT (ConT (mkName "RpcOutputSet")) (VarT (mkName $ "a" <> show i))+ ,AppT (ConT (mkName "RpcResultSet")) (VarT (mkName $ "b" <> show i))+ ]) [1..n])+#else+ (concatMap (\i->[ClassP (mkName "RpcOutputSet") [(VarT (mkName $ "a" <> show i))]+ ,ClassP (mkName "RpcResultSet") [(VarT (mkName $ "b" <> show i))]+ ]) [1..n])+#endif+ (AppT (ConT (mkName "RpcResponseSet"))+ (foldl' (\x i -> AppT x (AppT (AppT (ConT (mkName "RpcResponse")) (VarT (mkName ("a" <> show i)))) (VarT (mkName ("b" <> show i)) )) ) (TupleT n) [1..n]))+ [ValD (VarP (mkName "rpcResponseSetParser"))+ (NormalB (DoE+ (+ (flip map [1..n] $ \i ->+ BindS+ (BangP (VarP (mkName $ "r" <> show i ))) (VarE (mkName "rpcResponseParser"))+ )+ <>+ [(NoBindS (AppE (VarE 'return) (TupE (map (\i->VarE (mkName $ "r" <> show i)) [1..n]) )) )]+ )+ )+ ) []+ ]++++rpcOutputSetTupleQ :: Int -> Q Dec+rpcOutputSetTupleQ n = returnQ $ rpcOutputSetTuple n++rpcOutputSetTuple :: Int -> Dec+rpcOutputSetTuple n =+#if MIN_VERSION_template_haskell(2,11,0)+ InstanceD Nothing+#else+ InstanceD+#endif+#if MIN_VERSION_template_haskell(2,10,0)+ (map (\i ->AppT (ConT ''Data) (VarT (mkName $ "a" <> show i))) [1..n])+#else+ (map (\i ->ClassP ''Data [(VarT (mkName $ "a" <> show i))]) [1..n])+#endif+ (AppT+ (ConT (mkName "RpcOutputSet"))+ (foldl' (\x i -> AppT x (VarT (mkName ("a" <> show i)))) (TupleT n) [1..n])+ )+ [FunD (mkName "fromReturnValues")+ [Clause+ [ListP (map (\i ->VarP (mkName $ "r" <> show i)) [1..n])]+ (NormalB (TupE (map (\i ->VarE (mkName $ "d" <> show i)) [1..n])))++ (map (\i->ValD (BangP (VarP (mkName $ "d" <> show i)))+ (NormalB (AppE+ (AppE+ (VarE (mkName "fromRawBytes"))+ (AppE (VarE (mkName "rvTypeInfo")) (VarE (mkName $ "r" <> show i)))+ )+ (AppE (VarE (mkName "rvRawBytes")) (VarE (mkName $ "r" <> show i))))+ ) []+ ) [1..n]+ )+ ,Clause [WildP] (NormalB (AppE (VarE 'error) (LitE (StringL $ "fromReturnValues: List length must be " <> show n)))) []+ ]+ ]++++rpcResultSetTupleQ :: Int -> Q Dec+rpcResultSetTupleQ n = returnQ $ rpcResultSetTuple n++rpcResultSetTuple :: Int -> Dec+rpcResultSetTuple n =+#if MIN_VERSION_template_haskell(2,11,0)+ InstanceD Nothing+#else+ InstanceD+#endif+#if MIN_VERSION_template_haskell(2,10,0)+ (map (\i->AppT (ConT (mkName "RpcResult")) (VarT (mkName $ "a" <> (show i)))) [1..n])+#else+ (map (\i ->ClassP (mkName "RpcResult") [(VarT (mkName $ "a" <> show i))]) [1..n])+#endif+ (AppT (ConT (mkName "RpcResultSet")) (foldl' (\x i -> AppT x (VarT (mkName ("a" <> show i)))) (TupleT n) [1..n]))+ [ValD (VarP (mkName "rpcResultSetParser"))+ (NormalB (DoE+ (+ (flip map [1..n] $ \i ->+ BindS+ (BangP (VarP (mkName $ "r" <> show i )))+ (SigE (VarE (mkName "rpcResultParser"))+ (ForallT+ [PlainTV (mkName $ "a" <> show i)]+#if MIN_VERSION_template_haskell(2,10,0)+ [AppT (ConT (mkName "RpcResult")) (VarT (mkName $ "a" <> show i))]+#else+ [ClassP (mkName "RpcResult") [VarT (mkName $ "a" <> show i)]]+#endif+ (AppT (ConT (mkName "Parser")) (VarT (mkName $ "a" <> show i)))+ )+ )+ )+ <>+ [(NoBindS (AppE (VarE 'return) (TupE (map (\i->VarE (mkName $ "r" <> show i)) [1..n]) )) )]+ )+ )+ ) []+ ]++++rpcQuerySetTupleQ :: Int -> Q Dec+rpcQuerySetTupleQ n = returnQ $ rpcQuerySetTuple n++rpcQuerySetTuple :: Int -> Dec+rpcQuerySetTuple n =+#if MIN_VERSION_template_haskell(2,11,0)+ InstanceD Nothing+#else+ InstanceD+#endif+#if MIN_VERSION_template_haskell(2,10,0)+ (concatMap (\i->[AppT (ConT (mkName "RpcQueryId")) (VarT (mkName $ "a" <> show i))+ ,AppT (ConT (mkName "RpcParamSet")) (VarT (mkName $ "b" <> show i))+ ]) [1..n])+#else+ (concatMap (\i->[ClassP (mkName "RpcQueryId") [(VarT (mkName $ "a" <> show i))]+ ,ClassP (mkName "RpcParamSet") [(VarT (mkName $ "b" <> show i))]+ ]) [1..n])+#endif+ (AppT (ConT (mkName "RpcQuerySet"))+ (foldl' (\x i -> AppT x (AppT (AppT (ConT (mkName "RpcQuery")) (VarT (mkName ("a" <> show i)))) (VarT (mkName ("b" <> show i)) )) ) (TupleT n) [1..n]))+ [FunD (mkName "toRpcRequest")+ [Clause+ [TupP+ (map (\i->ConP (mkName "RpcQuery") [VarP (mkName $ "a" <> show i),VarP (mkName $ "b" <> show i)]) [1..n])+ ]+ (NormalB (AppE+ (ConE (mkName "RpcRequest"))+ (ListE (map (\i->VarE (mkName $ "r" <> show i)) [1..n]))))+ (map (\i->ValD (BangP (VarP (mkName $ "r" <> show i)))+ (NormalB (AppE (AppE (VarE (mkName "toRpcReqBatch"))+ (VarE (mkName $ "a" <> show i))) (VarE (mkName $ "b" <> show i)))) []) [1..n])+ ]+ ]++++rpcParamSetTupleQ :: Int -> Q Dec+rpcParamSetTupleQ n = returnQ $ rpcParamSetTuple n++rpcParamSetTuple :: Int -> Dec+rpcParamSetTuple n =+#if MIN_VERSION_template_haskell(2,11,0)+ InstanceD Nothing+#else+ InstanceD+#endif+#if MIN_VERSION_template_haskell(2,10,0)+ (map (\i ->AppT (ConT ''Data) (VarT (mkName $ "a" <> show i))) [1..n])+#else+ (map (\i ->ClassP ''Data [(VarT (mkName $ "a" <> show i))]) [1..n])+#endif+ (AppT (ConT (mkName "RpcParamSet")) (foldl' (\x i -> AppT x (AppT (ConT (mkName "RpcParam")) (VarT (mkName ("a" <> show i))) ) ) (TupleT n) [1..n]))+ [FunD (mkName "toRpcReqBatchParams")+ [Clause+ [TupP (map (\i->VarP (mkName $ "d" <> show i)) [1..n])]+ (NormalB (ListE (map (\i ->VarE (mkName $ "p" <> show i)) [1..n]) ))+ (map (\i->ValD (BangP (VarP (mkName $ "p" <> show i)))+ (NormalB (AppE (VarE (mkName "rpcReqBatchParam")) (VarE (mkName $ "d" <> show i)))) []) [1..n])+ ]+ ]+++