postgresql-pure 0.1.3.0 → 0.2.0.0
raw patch · 35 files changed
+4166/−1696 lines, 35 filesdep +OneTupledep +postgresql-placeholder-convertersetup-changed
Dependencies added: OneTuple, postgresql-placeholder-converter
Files
- ChangeLog.md +12/−0
- README.md +1/−1
- Setup.hs +76/−75
- benchmark/requests-per-second.hs +0/−1
- postgresql-pure.cabal +23/−7
- src/Database/HDBC/PostgreSQL/Pure.hs +80/−51
- src/Database/HDBC/PostgreSQL/Pure/Parser.hs +0/−157
- src/Database/PostgreSQL/Pure.hs +24/−21
- src/Database/PostgreSQL/Pure/Internal/Builder.hs +1103/−0
- src/Database/PostgreSQL/Pure/Internal/Connection.hs +2/−1
- src/Database/PostgreSQL/Pure/Internal/Data.hs +9/−3
- src/Database/PostgreSQL/Pure/Internal/IsLabel.hs +0/−14
- src/Database/PostgreSQL/Pure/Internal/Length.hs +261/−0
- src/Database/PostgreSQL/Pure/Internal/Parser.hs +1079/−0
- src/Database/PostgreSQL/Pure/Internal/Query.hs +8/−8
- src/Database/PostgreSQL/Pure/Internal/SocketIO.hs +1/−1
- src/Database/PostgreSQL/Pure/List.hs +11/−2
- src/Database/PostgreSQL/Pure/Parser.hs +1/−1
- template/Builder.hs +554/−549
- template/BuilderItem.hs +10/−10
- template/Parser.hs +95/−8
- test-hdbc-postgresql/SpecificDB.hs +3/−3
- test-hdbc-postgresql/SpecificDBTests.hs +1/−1
- test-original/Database/HDBC/PostgreSQL/PureSpec.hs +120/−0
- test-original/Database/PostgreSQL/Pure/ListSpec.hs +313/−0
- test-original/Database/PostgreSQL/PureSpec.hs +314/−0
- test-original/Spec.hs +1/−0
- test-original/Test/Hspec/Core/Hooks/Extra.hs +30/−0
- test-relational-record/DataSource.hs +12/−2
- test-relational-record/DataSource/Pure.hs +22/−1
- test/Database/HDBC/PostgreSQL/PureSpec.hs +0/−120
- test/Database/PostgreSQL/Pure/ListSpec.hs +0/−313
- test/Database/PostgreSQL/PureSpec.hs +0/−315
- test/Spec.hs +0/−1
- test/Test/Hspec/Core/Hooks/Extra.hs +0/−30
ChangeLog.md view
@@ -1,5 +1,17 @@ # Changelog for postgresql-pure +## 0.2.0.0++### Breaking changes++- Remove orphan `IsLabel` instance definitions; #2 thanks to @nakaji-dayo.++### Other changes++- Add cleartext password authentication; #1 thanks to @goodlyrottenapple.+- Change the Haskell type corresponding to `timetz` from `(TimeOfDay, TimeZone)` to `TimeOfDayWithTimeZone`.+- Not only tuples but also other types which have `Length` type function can be record.+ ## 0.1.3.0 2020.06.15
README.md view
@@ -1,6 +1,6 @@ # postgresql-pure -[](http://hackage.haskell.org/package/postgresql-pure) [](https://kakkun61.visualstudio.com/postgresql-pure/_build/latest?definitionId=1&branchName=master) [](https://travis-ci.org/iij-ii/postgresql-pure)+[](http://hackage.haskell.org/package/postgresql-pure) [](https://iij-ii.github.io/postgresql-pure/) [](https://github.com/iij-ii/postgresql-pure/actions?query=workflow%3Abuild) [](https://github.com/iij-ii/postgresql-pure/actions?query=workflow%3Atest) ## Copyright
Setup.hs view
@@ -1,45 +1,54 @@-import Prelude hiding (head, init, last, reverse, tail)+{-# LANGUAGE TypeApplications #-}++import Prelude hiding (head, init, last, reverse, tail) import qualified Prelude -import Data.Char (isDigit)-import Data.Foldable (for_)-import Data.List (intercalate, intersperse, isPrefixOf, replicate, stripPrefix)-import Distribution.Simple (Args, UserHooks (preBuild), defaultMainWithHooks, simpleUserHooks)-import Distribution.Simple.Setup (BuildFlags)-import Distribution.Types.HookedBuildInfo (HookedBuildInfo, emptyHookedBuildInfo)-import System.Directory (copyFile, createDirectoryIfMissing, getTemporaryDirectory, removeFile)-import System.IO (Handle, IOMode (ReadMode), hClose, hGetLine, hIsEOF, hPutStrLn,- hSetNewlineMode, noNewlineTranslation, openTempFile, stdin, withFile)+import Control.Exception (IOException, try)+import Data.Char (isDigit)+import Data.Either (fromRight)+import Data.Foldable (for_)+import Data.List (intercalate, intersperse, isPrefixOf, replicate, stripPrefix)+import Distribution.Simple (Args, UserHooks (preBuild), defaultMainWithHooks, simpleUserHooks)+import Distribution.Simple.Setup (BuildFlags)+import Distribution.Types.HookedBuildInfo (HookedBuildInfo, emptyHookedBuildInfo)+import System.Directory (copyFile, createDirectoryIfMissing, getModificationTime,+ getTemporaryDirectory, removeFile)+import System.FilePath (dropExtension, takeFileName, (</>))+import System.IO (Handle, IOMode (ReadMode), hClose, hGetLine, hIsEOF, hPutStrLn,+ hSetNewlineMode, noNewlineTranslation, openTempFile, stdin,+ withFile) main :: IO () main = defaultMainWithHooks simpleUserHooks- { preBuild = \_ _ -> preProcessBuilder >> preProcessParser >> pure emptyHookedBuildInfo }+ { preBuild = \_ _ -> preProcessBuilder >> preProcessParser >> preProcessLength >> pure emptyHookedBuildInfo } -preProcessBuilder :: IO ()-preProcessBuilder = do+preProcess :: FilePath -> (Word -> [String] -> [String]) -> IO ()+preProcess srcPath embed = do let- dir = "src/Database/PostgreSQL/Pure/Internal"- file = "Builder.hs"- srcPath = dir ++ "/" ++ file- templatePath = "template/Builder.hs"- templateItemPath = "template/BuilderItem.hs"- tempPath <-- withFile templatePath ReadMode $ \template -> do- tempDir <- (++ "/postgresql-pure") <$> getTemporaryDirectory- createDirectoryIfMissing True tempDir- (tempPath, temp) <- openTempFile tempDir file- putStrLn $ "temporaly file: " ++ tempPath- hSetNewlineMode template noNewlineTranslation- hSetNewlineMode temp noNewlineTranslation- hSetNewlineMode stdin noNewlineTranslation- templateItem <- lines <$> readFile templateItemPath- loop template temp templateItem- hClose temp- pure tempPath- copyFile tempPath srcPath- removeFile tempPath+ fileName = takeFileName srcPath+ templatePath = "template" </> fileName+ templateItemPath = "template" </> dropExtension fileName ++ "Item.hs"+ d <- dirty srcPath templatePath templateItemPath+ if d+ then do+ putStrLn $ "necessary to update " ++ srcPath+ tempPath <-+ withFile templatePath ReadMode $ \template -> do+ tempDir <- (</> "postgresql-pure") <$> getTemporaryDirectory+ createDirectoryIfMissing True tempDir+ (tempPath, temp) <- openTempFile tempDir fileName+ hSetNewlineMode template noNewlineTranslation+ hSetNewlineMode temp noNewlineTranslation+ hSetNewlineMode stdin noNewlineTranslation+ templateItem <- lines <$> readFile templateItemPath+ loop template temp templateItem+ hClose temp+ pure tempPath+ copyFile tempPath srcPath+ removeFile tempPath+ else putStrLn $ "unnecessary to update " ++ srcPath where loop :: Handle -> Handle -> [String] -> IO () loop template temp templateItem =@@ -61,6 +70,9 @@ = embed n templateItem | otherwise = [line] +preProcessBuilder :: IO ()+preProcessBuilder = preProcess "src/Database/PostgreSQL/Pure/Internal/Builder.hs" embed+ where embed :: Word -> [String] -> [String] embed l templateItem | l >= 2 = concatMap go templateItem@@ -96,49 +108,8 @@ v012 = ('v':) . show <$> [0 ..] preProcessParser :: IO ()-preProcessParser = do- let- dir = "src/Database/PostgreSQL/Pure/Internal"- file = "Parser.hs"- srcPath = dir ++ "/" ++ file- templatePath = "template/Parser.hs"- templateItemPath = "template/ParserItem.hs"- tempPath <-- withFile templatePath ReadMode $ \template -> do- tempDir <- (++ "/postgresql-pure") <$> getTemporaryDirectory- createDirectoryIfMissing True tempDir- (tempPath, temp) <- openTempFile tempDir file- putStrLn $ "temporaly file: " ++ tempPath- hSetNewlineMode template noNewlineTranslation- hSetNewlineMode temp noNewlineTranslation- hSetNewlineMode stdin noNewlineTranslation- templateItem <- lines <$> readFile templateItemPath- loop template temp templateItem- hClose temp- pure tempPath- copyFile tempPath srcPath- removeFile tempPath+preProcessParser = preProcess "src/Database/PostgreSQL/Pure/Internal/Parser.hs" embed where- loop :: Handle -> Handle -> [String] -> IO ()- loop template temp templateItem =- go- where- go = do- eof <- hIsEOF template- if eof- then pure ()- else do- line <- hGetLine template- for_ (preprocess line templateItem) (hPutStrLn temp)- go-- preprocess :: String -> [String] -> [String]- preprocess line templateItem- | Just rest <- stripPrefix "---- embed " line- , let n = read $ takeWhile isDigit rest- = embed n templateItem- | otherwise = [line]- embed :: Word -> [String] -> [String] embed l templateItem | l >= 2 = concatMap go templateItem@@ -166,3 +137,33 @@ paren xs = "(" ++ intercalate ", " xs ++ ")" bracket xs = "[" ++ intercalate ", " xs ++ "]" i012 = ('i':) . show <$> [0 ..]++preProcessLength :: IO ()+preProcessLength = preProcess "src/Database/PostgreSQL/Pure/Internal/Length.hs" embed+ where+ embed :: Word -> [String] -> [String]+ embed l templateItem+ | l >= 2 = concatMap go templateItem+ | otherwise = error "length must be larger than or equal to 2"+ where+ go "" = [""]+ go t+ | Just rest <- stripPrefix "<tuple>" t = [tuple ++ Prelude.head (go rest)]+ | Just rest <- stripPrefix "<length>" t = [length ++ Prelude.head (go rest)]+ | Just rest <- stripPrefix "<" t = error $ "unknown tag: " ++ takeWhile (/= '>') rest+ | (s, rest) <- span (/= '<') t = [s ++ Prelude.head (go rest)]+ n = fromIntegral l+ tuple = paren $ take n i012+ length = show l+ paren xs = "(" ++ intercalate ", " xs ++ ")"+ i012 = ('i':) . show <$> [0 ..]++dirty :: FilePath -> FilePath -> FilePath -> IO Bool+dirty src template templateItem =+ try @IOException @Bool (do+ srcTime <- getModificationTime src+ templateTime <- getModificationTime template+ templateItemTime <- getModificationTime templateItem+ setupTime <- getModificationTime "Setup.hs"+ pure $ srcTime < maximum [templateTime, templateItemTime, setupTime]+ ) >>= pure . fromRight True
benchmark/requests-per-second.hs view
@@ -24,7 +24,6 @@ import Data.Scientific (Scientific) import Data.Time (Day, DiffTime, LocalTime, TimeOfDay, TimeZone, UTCTime) import Data.Tuple.Homotuple.Only ()-import Data.Tuple.List.Only () import Data.Tuple.Only import Options.Applicative import System.Clock
postgresql-pure.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: f757c949d0349b8b53ec562b1d70787caeecdb570097658b6d2373dcbbfb505e+-- hash: c401475640b1db36278cdd96378ae987840e458c06594e5eac434a2991e04cbf name: postgresql-pure-version: 0.1.3.0+version: 0.2.0.0 synopsis: pure Haskell PostgreSQL driver description: pure Haskell PostgreSQL driver category: Database@@ -36,6 +36,7 @@ Cabal , base , directory+ , filepath flag pure-md5 manual: False@@ -49,11 +50,9 @@ Database.PostgreSQL.Pure.Oid Database.PostgreSQL.Pure.Parser other-modules:- Database.HDBC.PostgreSQL.Pure.Parser Database.PostgreSQL.Pure.Internal.Connection Database.PostgreSQL.Pure.Internal.Data Database.PostgreSQL.Pure.Internal.Exception- Database.PostgreSQL.Pure.Internal.IsLabel Database.PostgreSQL.Pure.Internal.MonadFail Database.PostgreSQL.Pure.Internal.Query Database.PostgreSQL.Pure.Internal.SocketIO@@ -61,10 +60,12 @@ Database.PostgreSQL.Simple.Time.Internal.Printer Database.PostgreSQL.Pure.Internal.Builder Database.PostgreSQL.Pure.Internal.Parser+ Database.PostgreSQL.Pure.Internal.Length Paths_postgresql_pure autogen-modules: Database.PostgreSQL.Pure.Internal.Builder Database.PostgreSQL.Pure.Internal.Parser+ Database.PostgreSQL.Pure.Internal.Length Paths_postgresql_pure hs-source-dirs: src@@ -72,6 +73,7 @@ ghc-options: -Wall -Wcompat -Wincomplete-uni-patterns -Wincomplete-record-updates -Wmonomorphism-restriction -Wmissing-exported-signatures -Wmissing-export-lists -Wmissing-home-modules -Widentities -Wredundant-constraints -Wpartial-fields -Wno-name-shadowing -Wmissing-import-lists build-depends: HDBC+ , OneTuple , Only , attoparsec , base >=4.7@@ -87,6 +89,7 @@ , mtl , network , postgresql-binary+ , postgresql-placeholder-converter , pretty-hex , safe-exceptions , scientific@@ -113,6 +116,7 @@ ghc-options: -Wall -Wcompat -Wincomplete-uni-patterns -Wincomplete-record-updates -Wmonomorphism-restriction -Wmissing-exported-signatures -Wmissing-export-lists -Wmissing-home-modules -Widentities -Wredundant-constraints -Wpartial-fields -Wno-name-shadowing -threaded -rtsopts -with-rtsopts=-N -Wno-all -Wno-compat -Wno-incomplete-uni-patterns -Wno-incomplete-record-updates -Wno-monomorphism-restriction -Wno-missing-exported-signatures -Wno-missing-export-lists -Wno-missing-home-modules -Wno-identities -Wno-redundant-constraints -Wno-partial-fields build-depends: HDBC+ , OneTuple , Only , attoparsec , base >=4.7@@ -129,6 +133,7 @@ , mtl , network , postgresql-binary+ , postgresql-placeholder-converter , pretty-hex , safe-exceptions , scientific@@ -158,13 +163,14 @@ TestTime TestUtils Database.HDBC.PostgreSQL.Pure- Database.HDBC.PostgreSQL.Pure.Parser Database.PostgreSQL.Pure+ Database.PostgreSQL.Pure.Internal.Builder Database.PostgreSQL.Pure.Internal.Connection Database.PostgreSQL.Pure.Internal.Data Database.PostgreSQL.Pure.Internal.Exception- Database.PostgreSQL.Pure.Internal.IsLabel+ Database.PostgreSQL.Pure.Internal.Length Database.PostgreSQL.Pure.Internal.MonadFail+ Database.PostgreSQL.Pure.Internal.Parser Database.PostgreSQL.Pure.Internal.Query Database.PostgreSQL.Pure.Internal.SocketIO Database.PostgreSQL.Pure.List@@ -181,6 +187,7 @@ build-depends: HDBC , HUnit+ , OneTuple , Only , QuickCheck , attoparsec@@ -198,6 +205,7 @@ , network , old-time , postgresql-binary+ , postgresql-placeholder-converter , pretty-hex , safe-exceptions , scientific@@ -224,10 +232,11 @@ Test.Hspec.Core.Hooks.Extra Paths_postgresql_pure hs-source-dirs:- test+ test-original ghc-options: -Wall -Wcompat -Wincomplete-uni-patterns -Wincomplete-record-updates -Wmonomorphism-restriction -Wmissing-exported-signatures -Wmissing-export-lists -Wmissing-home-modules -Widentities -Wredundant-constraints -Wpartial-fields -Wno-name-shadowing -threaded -rtsopts -with-rtsopts=-N -Wno-incomplete-uni-patterns -Wno-missing-export-lists -Wno-monomorphism-restriction build-depends: HDBC+ , OneTuple , Only , attoparsec , base >=4.7@@ -245,6 +254,7 @@ , mtl , network , postgresql-binary+ , postgresql-placeholder-converter , postgresql-pure , pretty-hex , safe-exceptions@@ -278,6 +288,7 @@ HDBC , HDBC-postgresql , HDBC-session+ , OneTuple , Only , attoparsec , base >=4.7@@ -296,6 +307,7 @@ , network , persistable-record , postgresql-binary+ , postgresql-placeholder-converter , postgresql-pure , pretty-hex , relational-query@@ -327,6 +339,7 @@ ghc-options: -Wall -Wcompat -Wincomplete-uni-patterns -Wincomplete-record-updates -Wmonomorphism-restriction -Wmissing-exported-signatures -Wmissing-export-lists -Wmissing-home-modules -Widentities -Wredundant-constraints -Wpartial-fields -Wno-name-shadowing -threaded -rtsopts -with-rtsopts=-N build-depends: HDBC+ , OneTuple , Only , attoparsec , base >=4.7 && <5@@ -346,6 +359,7 @@ , optparse-applicative , postgresql-binary , postgresql-libpq+ , postgresql-placeholder-converter , postgresql-pure , pretty-hex , safe-exceptions@@ -378,6 +392,7 @@ ghc-options: -Wall -Wcompat -Wincomplete-uni-patterns -Wincomplete-record-updates -Wmonomorphism-restriction -Wmissing-exported-signatures -Wmissing-export-lists -Wmissing-home-modules -Widentities -Wredundant-constraints -Wpartial-fields -Wno-name-shadowing -threaded -rtsopts -with-rtsopts=-N build-depends: HDBC+ , OneTuple , Only , attoparsec , base >=4.7 && <5@@ -399,6 +414,7 @@ , optparse-applicative , postgresql-binary , postgresql-libpq+ , postgresql-placeholder-converter , postgresql-pure , postgresql-simple , pretty-hex
src/Database/HDBC/PostgreSQL/Pure.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE CPP #-}+{-# LANGUAGE DataKinds #-} {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-}@@ -13,7 +14,7 @@ -- | -- This is a compatible interface with @HDBC-postgresql@'s @Database.HDBC.PostgreSQL@ except 'Config'. ----- Prepared statements are closed when some requests come once 'Statement's are GCed, because HDBC doesn't have “close” interface.+-- Prepared statements are closed when some requests come once 'Statement's are GCed, because HDBC doesn't have "close" interface. module Database.HDBC.PostgreSQL.Pure ( -- * Connection Config (..)@@ -25,52 +26,61 @@ , begin ) where -import Database.HDBC.PostgreSQL.Pure.Parser (convertQuestionMarkStyleToDollarSignStyle, splitQueries)--import qualified Database.PostgreSQL.Pure.Internal.Connection as Pure-import qualified Database.PostgreSQL.Pure.Internal.Data as Pure-import qualified Database.PostgreSQL.Pure.Internal.Exception as Pure-import qualified Database.PostgreSQL.Pure.Internal.MonadFail as MonadFail-import qualified Database.PostgreSQL.Pure.List as Pure-import qualified Database.PostgreSQL.Pure.Oid as Oid+import qualified Database.PostgreSQL.Pure.Internal.Connection as Pure+import qualified Database.PostgreSQL.Pure.Internal.Data as Pure+import qualified Database.PostgreSQL.Pure.Internal.Exception as Pure+import qualified Database.PostgreSQL.Pure.Internal.MonadFail as MonadFail+import qualified Database.PostgreSQL.Pure.Internal.Parser as Pure+import qualified Database.PostgreSQL.Pure.List as Pure+import qualified Database.PostgreSQL.Pure.Oid as Oid+import qualified Database.PostgreSQL.Simple.Time.Internal.Parser as TimeParser+import qualified Database.PostgreSQL.Simple.Time.Internal.Printer as TimeBuilder -import Paths_postgresql_pure (version)+import Paths_postgresql_pure (version) -import Database.HDBC (IConnection (clone, commit, dbServerVer, dbTransactionSupport, describeTable, disconnect, getTables, hdbcClientVer, hdbcDriverName, prepare, proxiedClientName, proxiedClientVer, rollback, run, runRaw),- SqlColDesc (SqlColDesc, colDecDigits, colNullable, colOctetLength, colSize, colType),- SqlError (SqlError, seErrorMsg, seNativeError, seState),- SqlTypeId, throwSqlError)-import Database.HDBC.ColTypes (SqlInterval (SqlIntervalSecondT), SqlTypeId (SqlBigIntT, SqlBitT, SqlCharT, SqlDateT, SqlDecimalT, SqlDoubleT, SqlFloatT, SqlIntervalT, SqlTimeT, SqlTimeWithZoneT, SqlTimestampT, SqlTimestampWithZoneT, SqlUnknownT, SqlVarBinaryT, SqlVarCharT))-import Database.HDBC.Statement (SqlValue (SqlBool, SqlByteString, SqlChar, SqlDiffTime, SqlDouble, SqlInt32, SqlInt64, SqlInteger, SqlLocalDate, SqlLocalTime, SqlLocalTimeOfDay, SqlNull, SqlPOSIXTime, SqlRational, SqlString, SqlUTCTime, SqlWord32, SqlWord64, SqlZonedLocalTimeOfDay, SqlZonedTime),- Statement (Statement, describeResult, execute, executeMany, executeRaw, fetchRow, finish, getColumnNames, originalQuery))+import Database.HDBC (IConnection (clone, commit, dbServerVer, dbTransactionSupport, describeTable, disconnect, getTables, hdbcClientVer, hdbcDriverName, prepare, proxiedClientName, proxiedClientVer, rollback, run, runRaw),+ SqlColDesc (SqlColDesc, colDecDigits, colNullable, colOctetLength, colSize, colType),+ SqlError (SqlError, seErrorMsg, seNativeError, seState),+ SqlTypeId, throwSqlError)+import Database.HDBC.ColTypes (SqlInterval (SqlIntervalSecondT), SqlTypeId (SqlBigIntT, SqlBitT, SqlCharT, SqlDateT, SqlDecimalT, SqlDoubleT, SqlFloatT, SqlIntervalT, SqlTimeT, SqlTimeWithZoneT, SqlTimestampT, SqlTimestampWithZoneT, SqlUnknownT, SqlVarBinaryT, SqlVarCharT))+import Database.HDBC.Statement (SqlValue (SqlBool, SqlByteString, SqlChar, SqlDiffTime, SqlDouble, SqlInt32, SqlInt64, SqlInteger, SqlLocalDate, SqlLocalTime, SqlLocalTimeOfDay, SqlNull, SqlPOSIXTime, SqlRational, SqlString, SqlUTCTime, SqlWord32, SqlWord64, SqlZonedLocalTimeOfDay, SqlZonedTime),+ Statement (Statement, describeResult, execute, executeMany, executeRaw, fetchRow, finish, getColumnNames, originalQuery)) -import Control.Concurrent (MVar, modifyMVar_, newMVar)-import Control.Exception.Safe (Exception (displayException, fromException, toException),- impureThrow, try)-import Control.Monad (unless, void)-import qualified Data.ByteString as BS-import qualified Data.ByteString.Short as BSS-import qualified Data.ByteString.UTF8 as BSU-import Data.Convertible (Convertible (safeConvert), convert)-import Data.Default.Class (Default (def))-import Data.Foldable (for_)-import Data.Int (Int32, Int64)-import Data.IORef (IORef, mkWeakIORef, newIORef, readIORef, writeIORef)-import qualified Data.Map.Strict as M-import Data.Maybe (fromMaybe)-import Data.Scientific (FPFormat (Exponent), Scientific, formatScientific,- fromRationalRepetend)-import Data.String (IsString (fromString))-import Data.Time (DiffTime, NominalDiffTime, zonedTimeToUTC)-import Data.Traversable (for)-import Data.Tuple.Only (Only (Only))-import Data.Typeable (Typeable, cast)-import Data.Version (showVersion)-import Data.Word (Word32, Word64)-import qualified PostgreSQL.Binary.Encoding as BE+import Control.Concurrent (MVar, modifyMVar_, newMVar)+import Control.Exception.Safe (Exception (displayException, fromException, toException),+ impureThrow, try)+import Control.Monad (unless, void)+import qualified Data.ByteString as BS+import qualified Data.ByteString.Builder as BSB+import qualified Data.ByteString.Builder.Prim as BSBP+import qualified Data.ByteString.Lazy as BSL+import qualified Data.ByteString.Short as BSS+import qualified Data.ByteString.UTF8 as BSU+import Data.Convertible (Convertible (safeConvert), convert)+import Data.Default.Class (Default (def))+import Data.Foldable (for_)+import Data.Int (Int32, Int64)+import Data.IORef (IORef, mkWeakIORef, newIORef, readIORef, writeIORef)+import qualified Data.Map.Strict as M+import Data.Maybe (fromMaybe)+import Data.Scientific (FPFormat (Exponent), Scientific, formatScientific,+ fromRationalRepetend)+import Data.String (IsString (fromString))+import Data.Time (DiffTime, NominalDiffTime, zonedTimeToUTC)+import Data.Time (TimeOfDay, TimeZone, utc)+import Data.Traversable (for)+import Data.Tuple.Only (Only (Only))+import Data.Typeable (Typeable, cast)+import Data.Version (showVersion)+import Data.Word (Word32, Word64)+import Database.PostgreSQL.Placeholder.Convert (convertQuestionMarkStyleToDollarSignStyle,+ splitQueries)+import GHC.Records (HasField (getField))+import qualified PostgreSQL.Binary.Decoding as BD+import qualified PostgreSQL.Binary.Encoding as BE #if !MIN_VERSION_base(4,13,0)-import Control.Monad.Fail (MonadFail)+import Control.Monad.Fail (MonadFail) #endif -- | A configuration of a connection.@@ -91,8 +101,8 @@ -- 4096 -- -- @--- encodeString def = \code -> case code of \"UTF8\" -> 'pure' . 'BSU.fromString'; _ -> 'const' $ 'fail' $ "unexpected character code: " <> 'show' code--- decodeString def = \code -> case code of \"UTF8\" -> 'pure' . 'BSU.toString'; _ -> 'const' $ 'fail' $ "unexpected character code: " <> 'show' code+-- encodeString def = \\code -> case code of \"UTF8\" -> 'pure' . 'BSU.fromString'; _ -> 'const' $ 'fail' $ "unexpected character code: " <> 'show' code+-- decodeString def = \\code -> case code of \"UTF8\" -> 'pure' . 'BSU.toString'; _ -> 'const' $ 'fail' $ "unexpected character code: " <> 'show' code -- @ data Config = Config@@ -185,11 +195,11 @@ let encode = encodeString charCode decode = decodeString charCode- queryQS :: Pure.Query+ queryQS :: BS.ByteString queryQS = fromString query queryDS = case convertQuestionMarkStyleToDollarSignStyle queryQS of- Right q -> q+ Right q -> Pure.Query q Left err -> impureThrow $ RequestBuildingFailed $ "conversion from question mark style to dollar sign style: " <> err ps <- Pure.flush connection $ Pure.parse "" queryDS (Left (0, 0)) -- footnote [1] let@@ -207,7 +217,7 @@ decode = decodeString charCode queries = splitQueries $ fromString query for_ queries $ \q -> do- ps <- Pure.flush connection $ Pure.parse "" q (Left (0, 0)) -- footnote [1]+ ps <- Pure.flush connection $ Pure.parse "" (Pure.Query q) (Left (0, 0)) -- footnote [1] Pure.flush connection $ Pure.execute @_ @() 0 decode $ forceBind $ Pure.bind "" Pure.TextFormat Pure.TextFormat parameters encode ([] :: [SqlValue]) ps prepare hc@Connection { connection = connection@Pure.Connection { parameters }, statementCounter, unnecessaryPreparedStatemtnts, config = Config { encodeString, decodeString } } query =@@ -224,8 +234,8 @@ queryBS <- encodeIO query let queryDS =- case convertQuestionMarkStyleToDollarSignStyle $ Pure.Query queryBS of- Right q -> q+ case convertQuestionMarkStyleToDollarSignStyle queryBS of+ Right q -> Pure.Query q Left err -> impureThrow $ RequestBuildingFailed $ "conversion from question mark style to dollar sign style: " <> err countBS <- encodeIO $ show count let@@ -318,7 +328,7 @@ getColumnNames = convertException $ do closeUnnecessaryPreparedStatemtnts hc- sequence $ decodeIO . #name <$> Pure.resultInfos preparedStatement+ sequence $ decodeIO . getField @"name" <$> Pure.resultInfos preparedStatement originalQuery :: String originalQuery = query@@ -541,7 +551,7 @@ -- | Security risk of DoS attack. -- -- You should convert 'Rational' to 'Scientific' with 'fromRationalRepetend' in the user side.--- If the rational value is computed to repeating decimals like 1/3 = 0.3333…, this consumes a lot of memories.+-- If the rational value is computed to repeating decimals like 1/3 = 0.3333., this consumes a lot of memories. -- This is provided because of the HDBC compatibility. instance Pure.ToField Rational where toField _ encode Nothing format v =@@ -601,6 +611,25 @@ case M.lookup "client_encoding" params of Nothing -> fail "\"client_encoding\" backend parameter not found" Just code -> pure code++instance Pure.FromField (TimeOfDay, TimeZone) where+ fromField _ Pure.ColumnInfo { typeOid, Pure.formatCode } (Just v)+ | typeOid == Oid.timetz+ = case formatCode of+ Pure.TextFormat -> Pure.attoparsecParser ((,) <$> TimeParser.timeOfDay <*> (fromMaybe utc <$> TimeParser.timeZone)) v+ Pure.BinaryFormat -> Pure.valueParser BD.timetz_int v+ fromField _ Pure.ColumnInfo { typeOid } _ = fail $ "type mismatch (FromField): OID: " <> show typeOid <> ", Haskell: (TimeOfDay, TimeZone)"++instance Pure.ToField (TimeOfDay, TimeZone) where+ toField _ _ Nothing Pure.TextFormat = pure . Just . BSL.toStrict . BSB.toLazyByteString . BSBP.primBounded (TimeBuilder.timeOfDay BSBP.>*< TimeBuilder.timeZone)+ toField backendParams _ Nothing Pure.BinaryFormat =+ case M.lookup "integer_datetimes" backendParams of+ Nothing -> const $ fail "not found \"integer_datetimes\" backend parameter"+ Just "on" -> pure . Just . BE.encodingBytes . BE.timetz_int+ Just "off" -> pure . Just . BE.encodingBytes . BE.timetz_float+ Just v -> const $ fail $ "\"integer_datetimes\" has unrecognized value: " <> show v+ toField backendParams encode (Just o) f | o == Oid.timetz = Pure.toField backendParams encode Nothing f+ | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: (TimeOfDay, TimeZone))" -- Footnote -- [1] Dirty hack: The numbers 0 and 0 are not used, when the prepared statement procedure is not given to "bind".
− src/Database/HDBC/PostgreSQL/Pure/Parser.hs
@@ -1,157 +0,0 @@-{-# LANGUAGE OverloadedStrings #-}--module Database.HDBC.PostgreSQL.Pure.Parser- ( convertQuestionMarkStyleToDollarSignStyle- , splitQueries- ) where--import qualified Database.PostgreSQL.Pure.Internal.Data as Pure-import qualified Database.PostgreSQL.Pure.Internal.Parser as Pure--import Control.Monad (void)-import Control.Monad.State.Strict (StateT, evalStateT, lift, state)-import qualified Data.Attoparsec.ByteString as AP-import qualified Data.Attoparsec.ByteString.Char8 as APC-import Data.Attoparsec.Combinator ((<?>))-import qualified Data.Attoparsec.Combinator as AP-import qualified Data.Attoparsec.Internal.Types as API-import qualified Data.ByteString as BS-import qualified Data.ByteString.UTF8 as BSU--convertQuestionMarkStyleToDollarSignStyle :: Pure.Query -> Either String Pure.Query-convertQuestionMarkStyleToDollarSignStyle (Pure.Query q) =- flip AP.parseOnly q $- flip evalStateT 1 $- (Pure.Query . mconcat <$>) $ do- ss <-- AP.many' $- AP.choice- [ question- , lift questionLiteral- , lift singleQuoteLiteral- , lift doubleQuoteLiteral- , lift dollarQuoteLiteral- , lift lineComment- , lift blockComment- , lift $ BS.pack . (:[]) <$> AP.anyWord8- ]- lift AP.endOfInput- pure ss--singleQuoteLiteral :: AP.Parser BS.ByteString-singleQuoteLiteral = oneCharQuoteLiteral '\'' <?> "singleQuoteLiteral"--doubleQuoteLiteral :: AP.Parser BS.ByteString-doubleQuoteLiteral = oneCharQuoteLiteral '"' <?> "doubleQuoteLiteral"--oneCharQuoteLiteral :: Char -> AP.Parser BS.ByteString-oneCharQuoteLiteral quote =- takeConsumed $ do- void $ APC.char quote- body- void $ APC.char quote- where- body = do- void $ APC.takeTill ((||) <$> (== '\\') <*> (== quote))- AP.option () $ do- void $ APC.char '\\'- void APC.anyChar -- It continues although it is somthing wrong if the character does not stand for escape sequence.- body--dollarQuoteLiteral :: AP.Parser BS.ByteString-dollarQuoteLiteral =- (<?> "dollarQuoteLiteral") $- takeConsumed $ do- quote <- dollarQuote- go quote- where- dollarQuote =- (<?> "dollarQuote") $- takeConsumed $ do- void $ APC.char '$'- void $ AP.many' $ APC.satisfy ((&&) <$> (/= ' ') <*> (/= '$'))- void $ APC.char '$'- go quote = go'- where- go' = do- void $ AP.many' $ APC.satisfy (/= '$')- AP.choice- [ void $ AP.string quote- , APC.char '$' *> go'- ]--lineComment :: AP.Parser BS.ByteString-lineComment =- (<?> "lineComment") $- takeConsumed $ do- void "--"- void $ AP.many' $ APC.satisfy ((&&) <$> (/= '\r') <*> (/= '\n'))- AP.option () $ void APC.endOfLine--blockComment :: AP.Parser BS.ByteString-blockComment =- (<?> "blockComment") $- takeConsumed $ do- void "/*"- go- where- go = do- void $- AP.many' $- AP.choice- [ void blockComment- , void $ APC.satisfy ((&&) <$> (/= '/') <*> (/= '*'))- ]- AP.choice- [ void "*/"- , AP.lookAhead "/*" *> go- , APC.satisfy ((||) <$> (== '/') <*> (== '*')) *> go- ]--question :: StateT Int AP.Parser BS.ByteString-question = do- void $ lift $ APC.char '?'- i <- getAndIncrement- pure $ "$" <> BSU.fromString (show i)- where- getAndIncrement :: StateT Int AP.Parser Int- getAndIncrement = state (\i -> (i, i + 1))--questionLiteral :: AP.Parser BS.ByteString-questionLiteral = takeConsumed "\\?"--splitQueries :: Pure.Query -> [Pure.Query]-splitQueries query@(Pure.Query q) =- case AP.parseOnly parser q of- Right qs -> qs- Left _ -> [query]- where- parser =- ((Pure.Query <$>) . conv <$>) $- AP.many' $- AP.choice- [ APC.char ';' >> pure Nothing- , Just <$> singleQuoteLiteral- , Just <$> doubleQuoteLiteral- , Just <$> dollarQuoteLiteral- , Just <$> lineComment- , Just <$> blockComment- , Just . BS.pack . (:[]) <$> AP.anyWord8- ]- conv :: [Maybe BS.ByteString] -> [BS.ByteString]- conv =- foldr go []- where- go (Just s) (a:as) = (s <> a):as- go (Just s) [] = [s]- go Nothing acc = "":acc--takeConsumed :: AP.Parser a -> AP.Parser BS.ByteString-takeConsumed p = do- n <-- AP.lookAhead $ do- API.Pos startPos <- Pure.currentPos- void p- API.Pos endPos <- Pure.currentPos- pure $ endPos - startPos- AP.take n
src/Database/PostgreSQL/Pure.hs view
@@ -12,6 +12,7 @@ {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedLabels #-} {-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TypeApplications #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE UndecidableInstances #-} @@ -59,23 +60,25 @@ -- >>> import Data.Int (Int32) -- >>> import Data.ByteString (ByteString) -- >>> import Data.Tuple.Only (Only (Only))--- >>> import Data.Tuple.List.Only () -- >>> import Data.Tuple.Homotuple.Only ()+-- >>> import Data.Maybe (fromMaybe)+-- >>> import System.Environment (lookupEnv) -- >>>--- >>> conn <- connect def+-- >>> getEnvDef name value = fromMaybe value <$> lookupEnv name+-- >>>+-- >>> host' <- getEnvDef "PURE_HOST" "127.0.0.1"+-- >>> port' <- getEnvDef "PURE_PORT" "5432"+-- >>> user' <- getEnvDef "PURE_USER" "postgres"+-- >>> password' <- getEnvDef "PURE_PASSWORD" ""+-- >>> database' <- getEnvDef "PURE_DATABASE" "postgres"+-- >>>+-- >>> conn <- connect def { address = AddressNotResolved host' port', user = user', password = password', database = database' } -- >>> preparedStatementProcedure = parse "" "SELECT id, name FROM person WHERE id = $1" Nothing -- >>> portalProcedure <- bind @_ @2 @_ @_ "" BinaryFormat BinaryFormat (parameters conn) (const $ fail "") (Only (1 :: Int32)) preparedStatementProcedure -- >>> executedProcedure = execute @_ @_ @(Int32, ByteString) 0 (const $ fail "") portalProcedure -- >>> ((_, _, e, _), _) <- sync conn executedProcedure -- >>> records e -- [(1,"Ada")]------ = Hints for Type Errors------ This module uses type level natural numbers as the number of columns of parameters and results.------ If you have constranit errors about tuples, you may forget to import @Data.Tuple.List@, @Data.Tuple.Homotuple@ and so on, because tuples are treated as vecters with typle level lengths.--- You can use list interfaces with @Database.PostgreSQL.Pure.List@, if these errors bother you. module Database.PostgreSQL.Pure ( -- * Connection Config (..)@@ -136,6 +139,7 @@ , ToField (..) , ToRecord (..) , Raw (..)+ , Length -- * Exception , Exception.Exception (..) , Exception.ErrorResponse (..)@@ -160,7 +164,7 @@ TransactionState) import qualified Database.PostgreSQL.Pure.Internal.Data as Data import qualified Database.PostgreSQL.Pure.Internal.Exception as Exception-import Database.PostgreSQL.Pure.Internal.IsLabel ()+import Database.PostgreSQL.Pure.Internal.Length (Length) import Database.PostgreSQL.Pure.Internal.Query (Close, Message, close, flush, sync) import qualified Database.PostgreSQL.Pure.Internal.Query as Query @@ -168,9 +172,8 @@ import Data.Kind (Type) import Data.Proxy (Proxy (Proxy)) import Data.Tuple.Homotuple (Homotuple, IsHomolisttuple, IsHomotupleItem)-import Data.Tuple.List (HasLength, Length)+import qualified Data.Tuple.List as Tuple import GHC.Exts (IsList (Item, fromList, toList))-import GHC.OverloadedLabels (IsLabel) import GHC.Records (HasField (getField)) import GHC.TypeLits (KnownNat, Nat, natVal) @@ -227,7 +230,7 @@ type instance MessageResult (PortalProcedure n m) = (PreparedStatement n m, Portal n m) --- | This represents a result of a “Execute” message which is already processed by a server.+-- | This represents a result of a "Execute" message which is already processed by a server. newtype Executed (parameterLength :: Nat) (resultLength :: Nat) r = Executed (Data.Executed r) deriving newtype (Show, Eq)@@ -240,7 +243,7 @@ records :: Executed n m r -> [r] records (Executed Data.Executed { records }) = records --- | This represents a result of a “Execute” message which is not yet processed by a server.+-- | This represents a result of a "Execute" message which is not yet processed by a server. newtype ExecutedProcedure (parameterLength :: Nat) (resultLength :: Nat) r = ExecutedProcedure (Data.ExecutedProcedure r) deriving newtype (Show, Message)@@ -254,8 +257,8 @@ -- | To get a name of @r@. name :: r -> Name r- default name :: IsLabel "name" (r -> Name r) => r -> Name r- name = #name+ default name :: HasField "name" r (Name r) => r -> Name r+ name = getField @"name" instance HasName (PreparedStatement n m) where type Name (PreparedStatement n m) = PreparedStatementName@@ -273,8 +276,8 @@ class HasParameterOids r a where -- | To get OIDs of a parameter. parameterOids :: r -> a- default parameterOids :: IsLabel "parameterOids" (r -> a) => r -> a- parameterOids = #parameterOids+ default parameterOids :: HasField "parameterOids" r a => r -> a+ parameterOids = getField @"parameterOids" instance (oids ~ Homotuple n Oid, Item oids ~ Oid, IsList oids) => HasParameterOids (PreparedStatement n m) oids @@ -315,7 +318,7 @@ :: forall rlen param m. ( ToRecord param , KnownNat rlen- , HasLength (Homotuple rlen ColumnInfo)+ , Tuple.HasLength (Homotuple rlen ColumnInfo) , MonadFail m ) => PortalName -- ^ A new name of portal.@@ -331,7 +334,7 @@ bind :: forall rlen param m. ( ToRecord param- , HasLength (Homotuple rlen ColumnInfo)+ , Tuple.HasLength (Homotuple rlen ColumnInfo) , MonadFail m ) => PortalName -> FormatCode -> FormatCode -> BackendParameters -> StringEncoder -> param -> PreparedStatement (Length param) rlen -> m (PortalProcedure (Length param) rlen)@@ -356,7 +359,7 @@ , IsHomotupleItem (Length result) ColumnInfo , IsHomolisttuple (Length result) ColumnInfo )- => Word -- ^ How many records to get. “0” means unlimited.+ => Word -- ^ How many records to get. "0" means unlimited. -> StringDecoder -- ^ How to decode strings. -> p plen (Length result) -- ^ Portal. -> ExecutedProcedure plen (Length result) result
+ src/Database/PostgreSQL/Pure/Internal/Builder.hs view
@@ -0,0 +1,1103 @@+{-# LANGUAGE CPP #-}+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE PatternSynonyms #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE TypeSynonymInstances #-}+{-# LANGUAGE UndecidableInstances #-}++{-# OPTIONS_GHC -Wno-orphans #-}++#include "MachDeps.h"++module Database.PostgreSQL.Pure.Internal.Builder+ ( startup+ , password+ , terminate+ , query+ , parse+ , bind+ , execute+ , describePreparedStatement+ , describePortal+ , flush+ , sync+ , closePreparedStatement+ , closePortal+ ) where++import Database.PostgreSQL.Pure.Internal.Data (BindParameterFormatCodes (BindParameterFormatCodesAll, BindParameterFormatCodesAllDefault, BindParameterFormatCodesEach),+ BindResultFormatCodes (BindResultFormatCodesAllDefault, BindResultFormatCodesEach, BindResultFormatCodesNothing),+ FormatCode (BinaryFormat, TextFormat), Oid (Oid),+ PortalName (PortalName),+ PreparedStatementName (PreparedStatementName),+ Query (Query), TimeOfDayWithTimeZone (TimeOfDayWithTimeZone), ToField (toField),+ ToRecord (toRecord))+import Database.PostgreSQL.Pure.Internal.Exception (cantReachHere)+import qualified Database.PostgreSQL.Pure.Internal.MonadFail as MonadFail+import qualified Database.PostgreSQL.Pure.Oid as Oid+import qualified Database.PostgreSQL.Simple.Time.Internal.Printer as Time++import Control.Exception.Safe (assert)+import qualified Data.Bool as B+import qualified Data.ByteString as BS+import qualified Data.ByteString.Builder as BSB+import qualified Data.ByteString.Builder.Prim as BSBP+import qualified Data.ByteString.Lazy as BSL+import qualified Data.Double.Conversion.ByteString as DC+import Data.Fixed (Fixed (MkFixed), HasResolution, Pico, resolution)+import Data.Int (Int16, Int32, Int64)+import qualified Data.Map.Strict as M+import Data.Scientific (FPFormat (Exponent), Scientific, formatScientific,+ scientific)+import Data.Time (Day, DiffTime, NominalDiffTime, TimeOfDay,+ UTCTime)+import Data.Time.LocalTime (LocalTime)+import Data.Tuple.Single (Single, pattern Single)+import qualified PostgreSQL.Binary.Encoding as BE++startup+ :: String -- ^ user name. ASCII text.+ -> String -- ^ database name. ASCII text.+ -> BSB.Builder+startup user database =+ let+ len =+ 4 -- length field+ + 2 -- protocol major version+ + 2 -- protocol minor version+ + 5 -- "user\0"+ + length user+ + 1 -- '\0'+ + 9 -- "database\0"+ + length database+ + 1 -- '\0'+ + 1 -- '\0'+ in+ BSB.int32BE (fromIntegral len)+ <> BSB.int16BE 3 -- protocol major version+ <> BSB.int16BE 0 -- protocol minor version+ <> BSB.string7 "user\0"+ <> BSB.string7 user+ <> BSB.char7 '\0'+ <> BSB.string7 "database\0" <> BSB.string7 database <> BSB.char7 '\0'+ <> BSB.char7 '\0'++password+ :: BS.ByteString -- ^ password, which may be hashed. ASCII text.+ -> BSB.Builder+password password =+ let+ len = 4 + BS.length password + 1+ in+ BSB.char7 'p'+ <> BSB.int32BE (fromIntegral len)+ <> BSB.byteString password+ <> BSB.char7 '\0'++query :: Query -> BSB.Builder+query (Query q) =+ let+ len = 4 + BS.length q + 1+ in+ BSB.char7 'Q'+ <> BSB.int32BE (fromIntegral len)+ <> BSB.byteString q+ <> BSB.char7 '\0'++terminate :: BS.ByteString+terminate = BS.pack [0x58, 0, 0, 0, 4]++parse+ :: PreparedStatementName+ -> Query+ -> [Oid] -- ^ OIDs of data types of parameters+ -> BSB.Builder+parse (PreparedStatementName name) (Query q) oids =+ let+ len = 4 + BS.length name + 1 + BS.length q + 1 + 2 + noids * 4+ noids = length oids+ in+ BSB.char7 'P'+ <> BSB.int32BE (fromIntegral len)+ <> BSB.byteString name+ <> BSB.char7 '\0'+ <> BSB.byteString q+ <> BSB.char7 '\0'+ <> BSB.int16BE (fromIntegral noids)+ <> mconcat (BSB.int32BE . (\(Oid n) -> n) <$> oids)++bind+ :: PortalName+ -> PreparedStatementName+ -> BindParameterFormatCodes+ -> [Maybe BS.ByteString]+ -> BindResultFormatCodes+ -> BSB.Builder+bind (PortalName portalName) (PreparedStatementName preparedStatementName) parameterFormatCodes parameters resultFormatCodes =+ let+ len =+ 4 -- length field+ + BS.length portalName+ + 1 -- '\0'+ + BS.length preparedStatementName+ + 1 -- '\0'+ + 2 -- the number of parameter format codes+ + ( case parameterFormatCodes of -- format codes+ BindParameterFormatCodesAllDefault -> 0+ BindParameterFormatCodesAll _ -> 2+ BindParameterFormatCodesEach cs -> 2 * length cs+ )+ + 2 -- the number of parameters+ + 4 * length parameters -- length field of each parameters+ + sum ((\p -> case p of Just bs -> BS.length bs; Nothing -> 0) <$> parameters) -- parameters themselves+ + 2 -- the number of result format codes+ + ( case resultFormatCodes of -- format codes+ BindResultFormatCodesNothing -> 0+ BindResultFormatCodesAllDefault -> 0+ BindResultFormatCodesEach cs -> 2 * length cs+ )+ in+ BSB.char7 'B'+ <> BSB.int32BE (fromIntegral len)+ <> BSB.byteString portalName+ <> BSB.char7 '\0'+ <> BSB.byteString preparedStatementName+ <> BSB.char7 '\0'+ <> ( case parameterFormatCodes of+ BindParameterFormatCodesAllDefault -> BSB.int16BE 0+ BindParameterFormatCodesAll c -> BSB.int16BE 1 <> BSB.int16BE (fromIntegral $ fromEnum c)+ BindParameterFormatCodesEach cs -> BSB.int16BE (fromIntegral $ length cs) <> mconcat (BSB.int16BE . fromIntegral . fromEnum <$> cs)+ )+ <> BSB.int16BE (fromIntegral $ length parameters)+ <> mconcat+ ( ( \p ->+ case p of+ Just bs -> BSB.int32BE (fromIntegral $ BS.length bs) <> BSB.byteString bs+ Nothing -> BSB.int32BE (-1)+ ) <$> parameters+ )+ <> ( case resultFormatCodes of+ BindResultFormatCodesNothing -> BSB.int16BE 0+ BindResultFormatCodesAllDefault -> BSB.int16BE 1+ BindResultFormatCodesEach cs -> BSB.int16BE (fromIntegral $ length cs) <> mconcat (BSB.int16BE . fromIntegral . fromEnum <$> cs)+ )++execute+ :: PortalName+ -> Int -- ^ limit of the number of rows+ -> BSB.Builder+execute (PortalName name) limitRows =+ let+ len = 4 + BS.length name + 1 + 4+ in+ BSB.char7 'E'+ <> BSB.int32BE (fromIntegral len)+ <> BSB.byteString name+ <> BSB.char7 '\0'+ <> BSB.int32BE (fromIntegral limitRows)++flush :: BS.ByteString+flush = BS.pack [0x48, 0, 0, 0, 4]++sync :: BS.ByteString+sync = BS.pack [0x53, 0, 0, 0, 4]++describePreparedStatement :: PreparedStatementName -> BSB.Builder+describePreparedStatement (PreparedStatementName name) = doDescribe 'S' name++closePreparedStatement :: PreparedStatementName -> BSB.Builder+closePreparedStatement (PreparedStatementName name) = doClose 'S' name++describePortal :: PortalName -> BSB.Builder+describePortal (PortalName name) = doDescribe 'P' name++closePortal :: PortalName -> BSB.Builder+closePortal (PortalName name) = doClose 'P' name++doDescribe :: Char -> BS.ByteString -> BSB.Builder+doDescribe typ name =+ let+ len = 4 + 1 + BS.length name + 1+ in+ BSB.char7 'D'+ <> BSB.int32BE (fromIntegral len)+ <> BSB.char7 typ+ <> BSB.byteString name+ <> BSB.char7 '\0'++doClose :: Char -> BS.ByteString -> BSB.Builder+doClose typ name =+ let+ len = 4 + 1 + BS.length name + 1+ in+ BSB.char7 'C'+ <> BSB.int32BE (fromIntegral len)+ <> BSB.char7 typ+ <> BSB.byteString name+ <> BSB.char7 '\0'++instance ToField () where+ toField _ _ _ _ _ = fail "no values for units"++instance ToField Bool where+ toField _ _ Nothing TextFormat = pure . Just . B.bool "TRUE" "FALSE"+ toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.bool+ toField backendParams encode (Just o) f | o == Oid.bool = toField backendParams encode Nothing f+ | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: Bool"++instance ToField Int where+#if WORD_SIZE_IN_BITS > 64+ toField _ _ _ _ _ = fail "the Int's size is too large, larger then 64 bits"+#else+ toField _ _ Nothing TextFormat = pure . Just. BSL.toStrict . BSB.toLazyByteString . BSB.intDec+#if WORD_SIZE_IN_BITS > 32+ toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.int8_int64 . fromIntegral+ toField backendParams encode (Just o) TextFormat | o == Oid.int8 = toField backendParams encode Nothing TextFormat+ toField backendParams encode (Just o) BinaryFormat | o == Oid.int8 = toField backendParams encode Nothing BinaryFormat+#else /* the width of Int is wider than 30 bits */+ toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.int4_int32 . fromIntegral+ toField backendParams encode (Just o) TextFormat | o `elem` [Oid.int4, Oid.int8] = toField backendParams encode Nothing TextFormat+ toField backendParams encode (Just o) BinaryFormat | o == Oid.int4 = toField backendParams encode Nothing BinaryFormat+ | o == Oid.int8 = pure . Just . BE.encodingBytes . BE.int8_int64 . fromIntegral+#endif+ toField _ _ (Just o) _ = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: Int"+#endif++instance ToField Int16 where+ toField _ _ Nothing TextFormat = pure . Just . BSL.toStrict . BSB.toLazyByteString . BSB.int16Dec+ toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.int2_int16+ toField backendParams encode (Just o) f | o == Oid.int2 = toField backendParams encode Nothing f+ | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: Int16"++instance ToField Int32 where+ toField _ _ Nothing TextFormat = pure . Just . BSL.toStrict . BSB.toLazyByteString . BSB.int32Dec+ toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.int4_int32+ toField backendParams encode (Just o) TextFormat | o `elem` [Oid.int4, Oid.int8] = toField backendParams encode Nothing TextFormat+ toField backendParams encode (Just o) BinaryFormat | o == Oid.int4 = toField backendParams encode Nothing BinaryFormat+ | o == Oid.int8 = pure . Just . BE.encodingBytes . BE.int8_int64 . fromIntegral+ toField _ _ (Just o) _ = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: Int32"++instance ToField Int64 where+ toField _ _ Nothing TextFormat = pure . Just . BSL.toStrict . BSB.toLazyByteString . BSB.int64Dec+ toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.int8_int64+ toField backendParams encode (Just o) f | o == Oid.int8 = toField backendParams encode Nothing f+ | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: Int64"++instance ToField Float where+ toField _ _ Nothing TextFormat = pure . Just . DC.toShortest . realToFrac+ toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.float4+ toField backendParams encode (Just o) TextFormat | o `elem` [Oid.float4, Oid.float8] = toField backendParams encode Nothing TextFormat+ toField backendParams encode (Just o) BinaryFormat | o == Oid.float4 = toField backendParams encode Nothing BinaryFormat+ | o == Oid.float8 = pure . Just . BE.encodingBytes . BE.float8 . realToFrac+ toField _ _ (Just o) _ = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: Float"++instance ToField Double where+ toField _ _ Nothing TextFormat = pure . Just . DC.toShortest+ toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.float8+ toField backendParams encode (Just o) f | o == Oid.float8 = toField backendParams encode Nothing f+ | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: Double"++instance ToField Scientific where+ toField _ encode Nothing TextFormat = (Just <$>) . MonadFail.fromEither . encode . formatScientific Exponent Nothing+ toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.numeric+ toField backendParams encode (Just o) f | o == Oid.numeric = toField backendParams encode Nothing f+ | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: Scientific"++instance HasResolution a => ToField (Fixed a) where+ toField _ encode Nothing TextFormat v = Just <$> MonadFail.fromEither (encode (show v)) -- XXX maybe slow+ toField _ _ Nothing BinaryFormat v@(MkFixed i) = pure $ Just $ BE.encodingBytes $ BE.numeric $ scientific i (fromInteger $ resolution v)+ toField backendParams encode (Just o) f v | o == Oid.numeric = toField backendParams encode Nothing f v+ | otherwise = fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: Fixed a (" <> show (resolution v) <> ")"++instance ToField Char where+ toField _ encode Nothing _ v = Just <$> MonadFail.fromEither (encode [v])+ toField backendParams encode (Just o) f v | o == Oid.char = toField backendParams encode Nothing f v+ | otherwise = fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: Char"++instance ToField String where+ toField _ encode Nothing _ = (Just <$>) . MonadFail.fromEither . encode+ toField backendParams encode (Just _) TextFormat = toField backendParams encode Nothing TextFormat+ toField backendParams encode (Just o) BinaryFormat | o `elem` [Oid.text, Oid.bpchar, Oid.varchar, Oid.name] = toField backendParams encode Nothing BinaryFormat+ | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: String"++instance ToField BS.ByteString where+ toField _ _ Nothing _ = pure . Just+ toField backendParams encode (Just o) f | o `elem` [Oid.text, Oid.bpchar, Oid.varchar, Oid.name, Oid.bytea] = toField backendParams encode Nothing f+ | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: ByteString (strict)"++instance ToField Day where -- TODO infinity/-infinity+ toField _ _ Nothing TextFormat = pure . Just . BSL.toStrict . BSB.toLazyByteString . BSBP.primBounded Time.day+ toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.date+ toField backendParams encode (Just o) f | o == Oid.date = toField backendParams encode Nothing f+ | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: Day"++instance ToField TimeOfDay where+ toField _ _ Nothing TextFormat = pure . Just . BSL.toStrict . BSB.toLazyByteString . BSBP.primBounded Time.timeOfDay+ toField backendParams _ Nothing BinaryFormat =+ case M.lookup "integer_datetimes" backendParams of+ Nothing -> const $ fail "not found \"integer_datetimes\" backend parameter"+ Just "on" -> pure . Just . BE.encodingBytes . BE.time_int+ Just "off" -> pure . Just . BE.encodingBytes . BE.time_float+ Just v -> const $ fail $ "\"integer_datetimes\" has unrecognized value: " <> show v+ toField backendParams encode (Just o) f | o == Oid.time = toField backendParams encode Nothing f+ | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: TimeOfDay"++instance ToField TimeOfDayWithTimeZone where+ toField _ _ Nothing TextFormat = pure . Just . BSL.toStrict . BSB.toLazyByteString . BSBP.primBounded (go BSBP.>$< Time.timeOfDay BSBP.>*< Time.timeZone)+ where go (TimeOfDayWithTimeZone t tz) = (t, tz)+ toField backendParams _ Nothing BinaryFormat =+ case M.lookup "integer_datetimes" backendParams of+ Nothing -> const $ fail "not found \"integer_datetimes\" backend parameter"+ Just "on" -> pure . Just . BE.encodingBytes . BE.timetz_int . \(TimeOfDayWithTimeZone t tz) -> (t, tz)+ Just "off" -> pure . Just . BE.encodingBytes . BE.timetz_float . \(TimeOfDayWithTimeZone t tz) -> (t, tz)+ Just v -> const $ fail $ "\"integer_datetimes\" has unrecognized value: " <> show v+ toField backendParams encode (Just o) f | o == Oid.timetz = toField backendParams encode Nothing f+ | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: TimeOfDayWithTimeZone)"++instance ToField LocalTime where+ toField _ _ Nothing TextFormat = pure . Just . BSL.toStrict . BSB.toLazyByteString . BSBP.primBounded Time.localTime+ toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.timestamp_int+ toField backendParams encode (Just o) f | o == Oid.timestamp = toField backendParams encode Nothing f+ | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: LocalTime"++instance ToField UTCTime where+ toField _ _ Nothing TextFormat = pure . Just . BSL.toStrict . BSB.toLazyByteString . BSBP.primBounded Time.utcTime+ toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.timestamptz_int+ toField backendParams encode (Just o) f | o == Oid.timestamptz = toField backendParams encode Nothing f+ | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: UTCTime"++instance ToField DiffTime where+ toField _ encode Nothing TextFormat = (Just <$>) . MonadFail.fromEither . encode . show -- XXX maybe slow+ toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.interval_int+ toField backendParams encode (Just o) f | o == Oid.interval = toField backendParams encode Nothing f+ | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: DiffTime"++instance ToField NominalDiffTime where+ toField backendParams encode Nothing f = toField backendParams encode Nothing f . (realToFrac :: NominalDiffTime -> Pico)+ toField backendParams encode (Just o) f | o == Oid.numeric = toField backendParams encode Nothing f+ | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: NominalDiffTime"++instance ToField Oid where+ toField _ _ Nothing TextFormat (Oid v) = pure $ Just $ BSL.toStrict $ BSB.toLazyByteString $ BSB.int32Dec v+ toField _ _ Nothing BinaryFormat (Oid v) = pure $ Just $ BE.encodingBytes $ BE.int4_int32 v+ toField backendParams encode (Just o) f v | o == Oid.oid = toField backendParams encode Nothing f v+ | otherwise = fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: Oid"++instance ToField a => ToField (Maybe a) where+ toField backendParams encode oid f (Just v) = toField backendParams encode oid f v+ toField _ _ _ _ Nothing = pure $ Just $ BE.encodingBytes $ BE.int4_int32 (-1)++-- 0 tuple+instance ToRecord () where+ toRecord _ _ Nothing [] _ =+ pure []+ toRecord _ _ Nothing fs _ =+ fail $ "the number of format codes must be 0, actually " <> show (length fs)+ toRecord _ _ (Just []) [] _ =+ pure []+ toRecord _ _ (Just os) [] _ =+ fail $ "the number of OIDs must be 0, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 0, actually " <> show (length fs)++-- 1 tuple+instance+ {-# OVERLAPPABLE #-}+ (ToField a, Single c, t ~ c a)+ => ToRecord t where+ toRecord backendParams encode Nothing [f] (Single v) =+ sequence [toField backendParams encode Nothing f v]+ toRecord _ _ Nothing [_] _ =+ cantReachHere+ toRecord backendParams encode (Just [o]) [f] (Single v) =+ sequence [toField backendParams encode (Just o) f v]+ toRecord _ _ (Just os) [_] _ =+ fail $ "the number of OIDs must be 1, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 1, actually " <> show (length fs)++-- 2-tuple+instance (ToField i0, ToField i1) => ToRecord (i0, i1) where+ toRecord backendParams encode Nothing [f0, f1] (v0, v1) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1]+ toRecord backendParams encode (Just [o0, o1]) [f0, f1] (v0, v1) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 2, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 2, actually " <> show (length fs)++-- 3-tuple+instance (ToField i0, ToField i1, ToField i2) => ToRecord (i0, i1, i2) where+ toRecord backendParams encode Nothing [f0, f1, f2] (v0, v1, v2) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2]+ toRecord backendParams encode (Just [o0, o1, o2]) [f0, f1, f2] (v0, v1, v2) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 3, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 3, actually " <> show (length fs)++-- 4-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3) => ToRecord (i0, i1, i2, i3) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3] (v0, v1, v2, v3) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3]+ toRecord backendParams encode (Just [o0, o1, o2, o3]) [f0, f1, f2, f3] (v0, v1, v2, v3) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 4, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 4, actually " <> show (length fs)++-- 5-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4) => ToRecord (i0, i1, i2, i3, i4) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4] (v0, v1, v2, v3, v4) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4]) [f0, f1, f2, f3, f4] (v0, v1, v2, v3, v4) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 5, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 5, actually " <> show (length fs)++-- 6-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5) => ToRecord (i0, i1, i2, i3, i4, i5) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5] (v0, v1, v2, v3, v4, v5) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5]) [f0, f1, f2, f3, f4, f5] (v0, v1, v2, v3, v4, v5) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 6, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 6, actually " <> show (length fs)++-- 7-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6) => ToRecord (i0, i1, i2, i3, i4, i5, i6) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6] (v0, v1, v2, v3, v4, v5, v6) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6]) [f0, f1, f2, f3, f4, f5, f6] (v0, v1, v2, v3, v4, v5, v6) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 7, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 7, actually " <> show (length fs)++-- 8-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7] (v0, v1, v2, v3, v4, v5, v6, v7) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7]) [f0, f1, f2, f3, f4, f5, f6, f7] (v0, v1, v2, v3, v4, v5, v6, v7) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 8, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 8, actually " <> show (length fs)++-- 9-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8] (v0, v1, v2, v3, v4, v5, v6, v7, v8) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8]) [f0, f1, f2, f3, f4, f5, f6, f7, f8] (v0, v1, v2, v3, v4, v5, v6, v7, v8) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 9, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 9, actually " <> show (length fs)++-- 10-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 10, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 10, actually " <> show (length fs)++-- 11-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 11, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 11, actually " <> show (length fs)++-- 12-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 12, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 12, actually " <> show (length fs)++-- 13-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 13, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 13, actually " <> show (length fs)++-- 14-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 14, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 14, actually " <> show (length fs)++-- 15-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 15, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 15, actually " <> show (length fs)++-- 16-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 16, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 16, actually " <> show (length fs)++-- 17-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 17, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 17, actually " <> show (length fs)++-- 18-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 18, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 18, actually " <> show (length fs)++-- 19-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 19, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 19, actually " <> show (length fs)++-- 20-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 20, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 20, actually " <> show (length fs)++-- 21-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 21, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 21, actually " <> show (length fs)++-- 22-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 22, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 22, actually " <> show (length fs)++-- 23-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 23, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 23, actually " <> show (length fs)++-- 24-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 24, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 24, actually " <> show (length fs)++-- 25-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 25, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 25, actually " <> show (length fs)++-- 26-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 26, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 26, actually " <> show (length fs)++-- 27-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25, ToField i26) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25, toField backendParams encode Nothing f26 v26]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25, o26]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25, toField backendParams encode (Just o26) f26 v26]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 27, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 27, actually " <> show (length fs)++-- 28-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25, ToField i26, ToField i27) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25, toField backendParams encode Nothing f26 v26, toField backendParams encode Nothing f27 v27]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25, o26, o27]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25, toField backendParams encode (Just o26) f26 v26, toField backendParams encode (Just o27) f27 v27]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 28, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 28, actually " <> show (length fs)++-- 29-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25, ToField i26, ToField i27, ToField i28) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25, toField backendParams encode Nothing f26 v26, toField backendParams encode Nothing f27 v27, toField backendParams encode Nothing f28 v28]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25, o26, o27, o28]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25, toField backendParams encode (Just o26) f26 v26, toField backendParams encode (Just o27) f27 v27, toField backendParams encode (Just o28) f28 v28]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 29, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 29, actually " <> show (length fs)++-- 30-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25, ToField i26, ToField i27, ToField i28, ToField i29) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25, toField backendParams encode Nothing f26 v26, toField backendParams encode Nothing f27 v27, toField backendParams encode Nothing f28 v28, toField backendParams encode Nothing f29 v29]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25, o26, o27, o28, o29]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25, toField backendParams encode (Just o26) f26 v26, toField backendParams encode (Just o27) f27 v27, toField backendParams encode (Just o28) f28 v28, toField backendParams encode (Just o29) f29 v29]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 30, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 30, actually " <> show (length fs)++-- 31-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25, ToField i26, ToField i27, ToField i28, ToField i29, ToField i30) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25, toField backendParams encode Nothing f26 v26, toField backendParams encode Nothing f27 v27, toField backendParams encode Nothing f28 v28, toField backendParams encode Nothing f29 v29, toField backendParams encode Nothing f30 v30]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25, o26, o27, o28, o29, o30]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25, toField backendParams encode (Just o26) f26 v26, toField backendParams encode (Just o27) f27 v27, toField backendParams encode (Just o28) f28 v28, toField backendParams encode (Just o29) f29 v29, toField backendParams encode (Just o30) f30 v30]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 31, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 31, actually " <> show (length fs)++-- 32-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25, ToField i26, ToField i27, ToField i28, ToField i29, ToField i30, ToField i31) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25, toField backendParams encode Nothing f26 v26, toField backendParams encode Nothing f27 v27, toField backendParams encode Nothing f28 v28, toField backendParams encode Nothing f29 v29, toField backendParams encode Nothing f30 v30, toField backendParams encode Nothing f31 v31]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25, o26, o27, o28, o29, o30, o31]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25, toField backendParams encode (Just o26) f26 v26, toField backendParams encode (Just o27) f27 v27, toField backendParams encode (Just o28) f28 v28, toField backendParams encode (Just o29) f29 v29, toField backendParams encode (Just o30) f30 v30, toField backendParams encode (Just o31) f31 v31]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 32, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 32, actually " <> show (length fs)++-- 33-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25, ToField i26, ToField i27, ToField i28, ToField i29, ToField i30, ToField i31, ToField i32) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25, toField backendParams encode Nothing f26 v26, toField backendParams encode Nothing f27 v27, toField backendParams encode Nothing f28 v28, toField backendParams encode Nothing f29 v29, toField backendParams encode Nothing f30 v30, toField backendParams encode Nothing f31 v31, toField backendParams encode Nothing f32 v32]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25, o26, o27, o28, o29, o30, o31, o32]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25, toField backendParams encode (Just o26) f26 v26, toField backendParams encode (Just o27) f27 v27, toField backendParams encode (Just o28) f28 v28, toField backendParams encode (Just o29) f29 v29, toField backendParams encode (Just o30) f30 v30, toField backendParams encode (Just o31) f31 v31, toField backendParams encode (Just o32) f32 v32]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 33, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 33, actually " <> show (length fs)++-- 34-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25, ToField i26, ToField i27, ToField i28, ToField i29, ToField i30, ToField i31, ToField i32, ToField i33) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25, toField backendParams encode Nothing f26 v26, toField backendParams encode Nothing f27 v27, toField backendParams encode Nothing f28 v28, toField backendParams encode Nothing f29 v29, toField backendParams encode Nothing f30 v30, toField backendParams encode Nothing f31 v31, toField backendParams encode Nothing f32 v32, toField backendParams encode Nothing f33 v33]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25, o26, o27, o28, o29, o30, o31, o32, o33]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25, toField backendParams encode (Just o26) f26 v26, toField backendParams encode (Just o27) f27 v27, toField backendParams encode (Just o28) f28 v28, toField backendParams encode (Just o29) f29 v29, toField backendParams encode (Just o30) f30 v30, toField backendParams encode (Just o31) f31 v31, toField backendParams encode (Just o32) f32 v32, toField backendParams encode (Just o33) f33 v33]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 34, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 34, actually " <> show (length fs)++-- 35-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25, ToField i26, ToField i27, ToField i28, ToField i29, ToField i30, ToField i31, ToField i32, ToField i33, ToField i34) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25, toField backendParams encode Nothing f26 v26, toField backendParams encode Nothing f27 v27, toField backendParams encode Nothing f28 v28, toField backendParams encode Nothing f29 v29, toField backendParams encode Nothing f30 v30, toField backendParams encode Nothing f31 v31, toField backendParams encode Nothing f32 v32, toField backendParams encode Nothing f33 v33, toField backendParams encode Nothing f34 v34]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25, o26, o27, o28, o29, o30, o31, o32, o33, o34]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25, toField backendParams encode (Just o26) f26 v26, toField backendParams encode (Just o27) f27 v27, toField backendParams encode (Just o28) f28 v28, toField backendParams encode (Just o29) f29 v29, toField backendParams encode (Just o30) f30 v30, toField backendParams encode (Just o31) f31 v31, toField backendParams encode (Just o32) f32 v32, toField backendParams encode (Just o33) f33 v33, toField backendParams encode (Just o34) f34 v34]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 35, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 35, actually " <> show (length fs)++-- 36-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25, ToField i26, ToField i27, ToField i28, ToField i29, ToField i30, ToField i31, ToField i32, ToField i33, ToField i34, ToField i35) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25, toField backendParams encode Nothing f26 v26, toField backendParams encode Nothing f27 v27, toField backendParams encode Nothing f28 v28, toField backendParams encode Nothing f29 v29, toField backendParams encode Nothing f30 v30, toField backendParams encode Nothing f31 v31, toField backendParams encode Nothing f32 v32, toField backendParams encode Nothing f33 v33, toField backendParams encode Nothing f34 v34, toField backendParams encode Nothing f35 v35]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25, o26, o27, o28, o29, o30, o31, o32, o33, o34, o35]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25, toField backendParams encode (Just o26) f26 v26, toField backendParams encode (Just o27) f27 v27, toField backendParams encode (Just o28) f28 v28, toField backendParams encode (Just o29) f29 v29, toField backendParams encode (Just o30) f30 v30, toField backendParams encode (Just o31) f31 v31, toField backendParams encode (Just o32) f32 v32, toField backendParams encode (Just o33) f33 v33, toField backendParams encode (Just o34) f34 v34, toField backendParams encode (Just o35) f35 v35]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 36, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 36, actually " <> show (length fs)++-- 37-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25, ToField i26, ToField i27, ToField i28, ToField i29, ToField i30, ToField i31, ToField i32, ToField i33, ToField i34, ToField i35, ToField i36) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25, toField backendParams encode Nothing f26 v26, toField backendParams encode Nothing f27 v27, toField backendParams encode Nothing f28 v28, toField backendParams encode Nothing f29 v29, toField backendParams encode Nothing f30 v30, toField backendParams encode Nothing f31 v31, toField backendParams encode Nothing f32 v32, toField backendParams encode Nothing f33 v33, toField backendParams encode Nothing f34 v34, toField backendParams encode Nothing f35 v35, toField backendParams encode Nothing f36 v36]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25, o26, o27, o28, o29, o30, o31, o32, o33, o34, o35, o36]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25, toField backendParams encode (Just o26) f26 v26, toField backendParams encode (Just o27) f27 v27, toField backendParams encode (Just o28) f28 v28, toField backendParams encode (Just o29) f29 v29, toField backendParams encode (Just o30) f30 v30, toField backendParams encode (Just o31) f31 v31, toField backendParams encode (Just o32) f32 v32, toField backendParams encode (Just o33) f33 v33, toField backendParams encode (Just o34) f34 v34, toField backendParams encode (Just o35) f35 v35, toField backendParams encode (Just o36) f36 v36]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 37, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 37, actually " <> show (length fs)++-- 38-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25, ToField i26, ToField i27, ToField i28, ToField i29, ToField i30, ToField i31, ToField i32, ToField i33, ToField i34, ToField i35, ToField i36, ToField i37) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25, toField backendParams encode Nothing f26 v26, toField backendParams encode Nothing f27 v27, toField backendParams encode Nothing f28 v28, toField backendParams encode Nothing f29 v29, toField backendParams encode Nothing f30 v30, toField backendParams encode Nothing f31 v31, toField backendParams encode Nothing f32 v32, toField backendParams encode Nothing f33 v33, toField backendParams encode Nothing f34 v34, toField backendParams encode Nothing f35 v35, toField backendParams encode Nothing f36 v36, toField backendParams encode Nothing f37 v37]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25, o26, o27, o28, o29, o30, o31, o32, o33, o34, o35, o36, o37]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25, toField backendParams encode (Just o26) f26 v26, toField backendParams encode (Just o27) f27 v27, toField backendParams encode (Just o28) f28 v28, toField backendParams encode (Just o29) f29 v29, toField backendParams encode (Just o30) f30 v30, toField backendParams encode (Just o31) f31 v31, toField backendParams encode (Just o32) f32 v32, toField backendParams encode (Just o33) f33 v33, toField backendParams encode (Just o34) f34 v34, toField backendParams encode (Just o35) f35 v35, toField backendParams encode (Just o36) f36 v36, toField backendParams encode (Just o37) f37 v37]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 38, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 38, actually " <> show (length fs)++-- 39-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25, ToField i26, ToField i27, ToField i28, ToField i29, ToField i30, ToField i31, ToField i32, ToField i33, ToField i34, ToField i35, ToField i36, ToField i37, ToField i38) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25, toField backendParams encode Nothing f26 v26, toField backendParams encode Nothing f27 v27, toField backendParams encode Nothing f28 v28, toField backendParams encode Nothing f29 v29, toField backendParams encode Nothing f30 v30, toField backendParams encode Nothing f31 v31, toField backendParams encode Nothing f32 v32, toField backendParams encode Nothing f33 v33, toField backendParams encode Nothing f34 v34, toField backendParams encode Nothing f35 v35, toField backendParams encode Nothing f36 v36, toField backendParams encode Nothing f37 v37, toField backendParams encode Nothing f38 v38]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25, o26, o27, o28, o29, o30, o31, o32, o33, o34, o35, o36, o37, o38]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25, toField backendParams encode (Just o26) f26 v26, toField backendParams encode (Just o27) f27 v27, toField backendParams encode (Just o28) f28 v28, toField backendParams encode (Just o29) f29 v29, toField backendParams encode (Just o30) f30 v30, toField backendParams encode (Just o31) f31 v31, toField backendParams encode (Just o32) f32 v32, toField backendParams encode (Just o33) f33 v33, toField backendParams encode (Just o34) f34 v34, toField backendParams encode (Just o35) f35 v35, toField backendParams encode (Just o36) f36 v36, toField backendParams encode (Just o37) f37 v37, toField backendParams encode (Just o38) f38 v38]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 39, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 39, actually " <> show (length fs)++-- 40-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25, ToField i26, ToField i27, ToField i28, ToField i29, ToField i30, ToField i31, ToField i32, ToField i33, ToField i34, ToField i35, ToField i36, ToField i37, ToField i38, ToField i39) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25, toField backendParams encode Nothing f26 v26, toField backendParams encode Nothing f27 v27, toField backendParams encode Nothing f28 v28, toField backendParams encode Nothing f29 v29, toField backendParams encode Nothing f30 v30, toField backendParams encode Nothing f31 v31, toField backendParams encode Nothing f32 v32, toField backendParams encode Nothing f33 v33, toField backendParams encode Nothing f34 v34, toField backendParams encode Nothing f35 v35, toField backendParams encode Nothing f36 v36, toField backendParams encode Nothing f37 v37, toField backendParams encode Nothing f38 v38, toField backendParams encode Nothing f39 v39]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25, o26, o27, o28, o29, o30, o31, o32, o33, o34, o35, o36, o37, o38, o39]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25, toField backendParams encode (Just o26) f26 v26, toField backendParams encode (Just o27) f27 v27, toField backendParams encode (Just o28) f28 v28, toField backendParams encode (Just o29) f29 v29, toField backendParams encode (Just o30) f30 v30, toField backendParams encode (Just o31) f31 v31, toField backendParams encode (Just o32) f32 v32, toField backendParams encode (Just o33) f33 v33, toField backendParams encode (Just o34) f34 v34, toField backendParams encode (Just o35) f35 v35, toField backendParams encode (Just o36) f36 v36, toField backendParams encode (Just o37) f37 v37, toField backendParams encode (Just o38) f38 v38, toField backendParams encode (Just o39) f39 v39]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 40, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 40, actually " <> show (length fs)++-- 41-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25, ToField i26, ToField i27, ToField i28, ToField i29, ToField i30, ToField i31, ToField i32, ToField i33, ToField i34, ToField i35, ToField i36, ToField i37, ToField i38, ToField i39, ToField i40) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25, toField backendParams encode Nothing f26 v26, toField backendParams encode Nothing f27 v27, toField backendParams encode Nothing f28 v28, toField backendParams encode Nothing f29 v29, toField backendParams encode Nothing f30 v30, toField backendParams encode Nothing f31 v31, toField backendParams encode Nothing f32 v32, toField backendParams encode Nothing f33 v33, toField backendParams encode Nothing f34 v34, toField backendParams encode Nothing f35 v35, toField backendParams encode Nothing f36 v36, toField backendParams encode Nothing f37 v37, toField backendParams encode Nothing f38 v38, toField backendParams encode Nothing f39 v39, toField backendParams encode Nothing f40 v40]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25, o26, o27, o28, o29, o30, o31, o32, o33, o34, o35, o36, o37, o38, o39, o40]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25, toField backendParams encode (Just o26) f26 v26, toField backendParams encode (Just o27) f27 v27, toField backendParams encode (Just o28) f28 v28, toField backendParams encode (Just o29) f29 v29, toField backendParams encode (Just o30) f30 v30, toField backendParams encode (Just o31) f31 v31, toField backendParams encode (Just o32) f32 v32, toField backendParams encode (Just o33) f33 v33, toField backendParams encode (Just o34) f34 v34, toField backendParams encode (Just o35) f35 v35, toField backendParams encode (Just o36) f36 v36, toField backendParams encode (Just o37) f37 v37, toField backendParams encode (Just o38) f38 v38, toField backendParams encode (Just o39) f39 v39, toField backendParams encode (Just o40) f40 v40]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 41, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 41, actually " <> show (length fs)++-- 42-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25, ToField i26, ToField i27, ToField i28, ToField i29, ToField i30, ToField i31, ToField i32, ToField i33, ToField i34, ToField i35, ToField i36, ToField i37, ToField i38, ToField i39, ToField i40, ToField i41) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25, toField backendParams encode Nothing f26 v26, toField backendParams encode Nothing f27 v27, toField backendParams encode Nothing f28 v28, toField backendParams encode Nothing f29 v29, toField backendParams encode Nothing f30 v30, toField backendParams encode Nothing f31 v31, toField backendParams encode Nothing f32 v32, toField backendParams encode Nothing f33 v33, toField backendParams encode Nothing f34 v34, toField backendParams encode Nothing f35 v35, toField backendParams encode Nothing f36 v36, toField backendParams encode Nothing f37 v37, toField backendParams encode Nothing f38 v38, toField backendParams encode Nothing f39 v39, toField backendParams encode Nothing f40 v40, toField backendParams encode Nothing f41 v41]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25, o26, o27, o28, o29, o30, o31, o32, o33, o34, o35, o36, o37, o38, o39, o40, o41]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25, toField backendParams encode (Just o26) f26 v26, toField backendParams encode (Just o27) f27 v27, toField backendParams encode (Just o28) f28 v28, toField backendParams encode (Just o29) f29 v29, toField backendParams encode (Just o30) f30 v30, toField backendParams encode (Just o31) f31 v31, toField backendParams encode (Just o32) f32 v32, toField backendParams encode (Just o33) f33 v33, toField backendParams encode (Just o34) f34 v34, toField backendParams encode (Just o35) f35 v35, toField backendParams encode (Just o36) f36 v36, toField backendParams encode (Just o37) f37 v37, toField backendParams encode (Just o38) f38 v38, toField backendParams encode (Just o39) f39 v39, toField backendParams encode (Just o40) f40 v40, toField backendParams encode (Just o41) f41 v41]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 42, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 42, actually " <> show (length fs)++-- 43-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25, ToField i26, ToField i27, ToField i28, ToField i29, ToField i30, ToField i31, ToField i32, ToField i33, ToField i34, ToField i35, ToField i36, ToField i37, ToField i38, ToField i39, ToField i40, ToField i41, ToField i42) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25, toField backendParams encode Nothing f26 v26, toField backendParams encode Nothing f27 v27, toField backendParams encode Nothing f28 v28, toField backendParams encode Nothing f29 v29, toField backendParams encode Nothing f30 v30, toField backendParams encode Nothing f31 v31, toField backendParams encode Nothing f32 v32, toField backendParams encode Nothing f33 v33, toField backendParams encode Nothing f34 v34, toField backendParams encode Nothing f35 v35, toField backendParams encode Nothing f36 v36, toField backendParams encode Nothing f37 v37, toField backendParams encode Nothing f38 v38, toField backendParams encode Nothing f39 v39, toField backendParams encode Nothing f40 v40, toField backendParams encode Nothing f41 v41, toField backendParams encode Nothing f42 v42]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25, o26, o27, o28, o29, o30, o31, o32, o33, o34, o35, o36, o37, o38, o39, o40, o41, o42]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25, toField backendParams encode (Just o26) f26 v26, toField backendParams encode (Just o27) f27 v27, toField backendParams encode (Just o28) f28 v28, toField backendParams encode (Just o29) f29 v29, toField backendParams encode (Just o30) f30 v30, toField backendParams encode (Just o31) f31 v31, toField backendParams encode (Just o32) f32 v32, toField backendParams encode (Just o33) f33 v33, toField backendParams encode (Just o34) f34 v34, toField backendParams encode (Just o35) f35 v35, toField backendParams encode (Just o36) f36 v36, toField backendParams encode (Just o37) f37 v37, toField backendParams encode (Just o38) f38 v38, toField backendParams encode (Just o39) f39 v39, toField backendParams encode (Just o40) f40 v40, toField backendParams encode (Just o41) f41 v41, toField backendParams encode (Just o42) f42 v42]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 43, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 43, actually " <> show (length fs)++-- 44-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25, ToField i26, ToField i27, ToField i28, ToField i29, ToField i30, ToField i31, ToField i32, ToField i33, ToField i34, ToField i35, ToField i36, ToField i37, ToField i38, ToField i39, ToField i40, ToField i41, ToField i42, ToField i43) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25, toField backendParams encode Nothing f26 v26, toField backendParams encode Nothing f27 v27, toField backendParams encode Nothing f28 v28, toField backendParams encode Nothing f29 v29, toField backendParams encode Nothing f30 v30, toField backendParams encode Nothing f31 v31, toField backendParams encode Nothing f32 v32, toField backendParams encode Nothing f33 v33, toField backendParams encode Nothing f34 v34, toField backendParams encode Nothing f35 v35, toField backendParams encode Nothing f36 v36, toField backendParams encode Nothing f37 v37, toField backendParams encode Nothing f38 v38, toField backendParams encode Nothing f39 v39, toField backendParams encode Nothing f40 v40, toField backendParams encode Nothing f41 v41, toField backendParams encode Nothing f42 v42, toField backendParams encode Nothing f43 v43]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25, o26, o27, o28, o29, o30, o31, o32, o33, o34, o35, o36, o37, o38, o39, o40, o41, o42, o43]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25, toField backendParams encode (Just o26) f26 v26, toField backendParams encode (Just o27) f27 v27, toField backendParams encode (Just o28) f28 v28, toField backendParams encode (Just o29) f29 v29, toField backendParams encode (Just o30) f30 v30, toField backendParams encode (Just o31) f31 v31, toField backendParams encode (Just o32) f32 v32, toField backendParams encode (Just o33) f33 v33, toField backendParams encode (Just o34) f34 v34, toField backendParams encode (Just o35) f35 v35, toField backendParams encode (Just o36) f36 v36, toField backendParams encode (Just o37) f37 v37, toField backendParams encode (Just o38) f38 v38, toField backendParams encode (Just o39) f39 v39, toField backendParams encode (Just o40) f40 v40, toField backendParams encode (Just o41) f41 v41, toField backendParams encode (Just o42) f42 v42, toField backendParams encode (Just o43) f43 v43]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 44, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 44, actually " <> show (length fs)++-- 45-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25, ToField i26, ToField i27, ToField i28, ToField i29, ToField i30, ToField i31, ToField i32, ToField i33, ToField i34, ToField i35, ToField i36, ToField i37, ToField i38, ToField i39, ToField i40, ToField i41, ToField i42, ToField i43, ToField i44) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25, toField backendParams encode Nothing f26 v26, toField backendParams encode Nothing f27 v27, toField backendParams encode Nothing f28 v28, toField backendParams encode Nothing f29 v29, toField backendParams encode Nothing f30 v30, toField backendParams encode Nothing f31 v31, toField backendParams encode Nothing f32 v32, toField backendParams encode Nothing f33 v33, toField backendParams encode Nothing f34 v34, toField backendParams encode Nothing f35 v35, toField backendParams encode Nothing f36 v36, toField backendParams encode Nothing f37 v37, toField backendParams encode Nothing f38 v38, toField backendParams encode Nothing f39 v39, toField backendParams encode Nothing f40 v40, toField backendParams encode Nothing f41 v41, toField backendParams encode Nothing f42 v42, toField backendParams encode Nothing f43 v43, toField backendParams encode Nothing f44 v44]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25, o26, o27, o28, o29, o30, o31, o32, o33, o34, o35, o36, o37, o38, o39, o40, o41, o42, o43, o44]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25, toField backendParams encode (Just o26) f26 v26, toField backendParams encode (Just o27) f27 v27, toField backendParams encode (Just o28) f28 v28, toField backendParams encode (Just o29) f29 v29, toField backendParams encode (Just o30) f30 v30, toField backendParams encode (Just o31) f31 v31, toField backendParams encode (Just o32) f32 v32, toField backendParams encode (Just o33) f33 v33, toField backendParams encode (Just o34) f34 v34, toField backendParams encode (Just o35) f35 v35, toField backendParams encode (Just o36) f36 v36, toField backendParams encode (Just o37) f37 v37, toField backendParams encode (Just o38) f38 v38, toField backendParams encode (Just o39) f39 v39, toField backendParams encode (Just o40) f40 v40, toField backendParams encode (Just o41) f41 v41, toField backendParams encode (Just o42) f42 v42, toField backendParams encode (Just o43) f43 v43, toField backendParams encode (Just o44) f44 v44]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 45, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 45, actually " <> show (length fs)++-- 46-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25, ToField i26, ToField i27, ToField i28, ToField i29, ToField i30, ToField i31, ToField i32, ToField i33, ToField i34, ToField i35, ToField i36, ToField i37, ToField i38, ToField i39, ToField i40, ToField i41, ToField i42, ToField i43, ToField i44, ToField i45) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25, toField backendParams encode Nothing f26 v26, toField backendParams encode Nothing f27 v27, toField backendParams encode Nothing f28 v28, toField backendParams encode Nothing f29 v29, toField backendParams encode Nothing f30 v30, toField backendParams encode Nothing f31 v31, toField backendParams encode Nothing f32 v32, toField backendParams encode Nothing f33 v33, toField backendParams encode Nothing f34 v34, toField backendParams encode Nothing f35 v35, toField backendParams encode Nothing f36 v36, toField backendParams encode Nothing f37 v37, toField backendParams encode Nothing f38 v38, toField backendParams encode Nothing f39 v39, toField backendParams encode Nothing f40 v40, toField backendParams encode Nothing f41 v41, toField backendParams encode Nothing f42 v42, toField backendParams encode Nothing f43 v43, toField backendParams encode Nothing f44 v44, toField backendParams encode Nothing f45 v45]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25, o26, o27, o28, o29, o30, o31, o32, o33, o34, o35, o36, o37, o38, o39, o40, o41, o42, o43, o44, o45]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25, toField backendParams encode (Just o26) f26 v26, toField backendParams encode (Just o27) f27 v27, toField backendParams encode (Just o28) f28 v28, toField backendParams encode (Just o29) f29 v29, toField backendParams encode (Just o30) f30 v30, toField backendParams encode (Just o31) f31 v31, toField backendParams encode (Just o32) f32 v32, toField backendParams encode (Just o33) f33 v33, toField backendParams encode (Just o34) f34 v34, toField backendParams encode (Just o35) f35 v35, toField backendParams encode (Just o36) f36 v36, toField backendParams encode (Just o37) f37 v37, toField backendParams encode (Just o38) f38 v38, toField backendParams encode (Just o39) f39 v39, toField backendParams encode (Just o40) f40 v40, toField backendParams encode (Just o41) f41 v41, toField backendParams encode (Just o42) f42 v42, toField backendParams encode (Just o43) f43 v43, toField backendParams encode (Just o44) f44 v44, toField backendParams encode (Just o45) f45 v45]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 46, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 46, actually " <> show (length fs)++-- 47-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25, ToField i26, ToField i27, ToField i28, ToField i29, ToField i30, ToField i31, ToField i32, ToField i33, ToField i34, ToField i35, ToField i36, ToField i37, ToField i38, ToField i39, ToField i40, ToField i41, ToField i42, ToField i43, ToField i44, ToField i45, ToField i46) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25, toField backendParams encode Nothing f26 v26, toField backendParams encode Nothing f27 v27, toField backendParams encode Nothing f28 v28, toField backendParams encode Nothing f29 v29, toField backendParams encode Nothing f30 v30, toField backendParams encode Nothing f31 v31, toField backendParams encode Nothing f32 v32, toField backendParams encode Nothing f33 v33, toField backendParams encode Nothing f34 v34, toField backendParams encode Nothing f35 v35, toField backendParams encode Nothing f36 v36, toField backendParams encode Nothing f37 v37, toField backendParams encode Nothing f38 v38, toField backendParams encode Nothing f39 v39, toField backendParams encode Nothing f40 v40, toField backendParams encode Nothing f41 v41, toField backendParams encode Nothing f42 v42, toField backendParams encode Nothing f43 v43, toField backendParams encode Nothing f44 v44, toField backendParams encode Nothing f45 v45, toField backendParams encode Nothing f46 v46]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25, o26, o27, o28, o29, o30, o31, o32, o33, o34, o35, o36, o37, o38, o39, o40, o41, o42, o43, o44, o45, o46]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25, toField backendParams encode (Just o26) f26 v26, toField backendParams encode (Just o27) f27 v27, toField backendParams encode (Just o28) f28 v28, toField backendParams encode (Just o29) f29 v29, toField backendParams encode (Just o30) f30 v30, toField backendParams encode (Just o31) f31 v31, toField backendParams encode (Just o32) f32 v32, toField backendParams encode (Just o33) f33 v33, toField backendParams encode (Just o34) f34 v34, toField backendParams encode (Just o35) f35 v35, toField backendParams encode (Just o36) f36 v36, toField backendParams encode (Just o37) f37 v37, toField backendParams encode (Just o38) f38 v38, toField backendParams encode (Just o39) f39 v39, toField backendParams encode (Just o40) f40 v40, toField backendParams encode (Just o41) f41 v41, toField backendParams encode (Just o42) f42 v42, toField backendParams encode (Just o43) f43 v43, toField backendParams encode (Just o44) f44 v44, toField backendParams encode (Just o45) f45 v45, toField backendParams encode (Just o46) f46 v46]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 47, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 47, actually " <> show (length fs)++-- 48-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25, ToField i26, ToField i27, ToField i28, ToField i29, ToField i30, ToField i31, ToField i32, ToField i33, ToField i34, ToField i35, ToField i36, ToField i37, ToField i38, ToField i39, ToField i40, ToField i41, ToField i42, ToField i43, ToField i44, ToField i45, ToField i46, ToField i47) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25, toField backendParams encode Nothing f26 v26, toField backendParams encode Nothing f27 v27, toField backendParams encode Nothing f28 v28, toField backendParams encode Nothing f29 v29, toField backendParams encode Nothing f30 v30, toField backendParams encode Nothing f31 v31, toField backendParams encode Nothing f32 v32, toField backendParams encode Nothing f33 v33, toField backendParams encode Nothing f34 v34, toField backendParams encode Nothing f35 v35, toField backendParams encode Nothing f36 v36, toField backendParams encode Nothing f37 v37, toField backendParams encode Nothing f38 v38, toField backendParams encode Nothing f39 v39, toField backendParams encode Nothing f40 v40, toField backendParams encode Nothing f41 v41, toField backendParams encode Nothing f42 v42, toField backendParams encode Nothing f43 v43, toField backendParams encode Nothing f44 v44, toField backendParams encode Nothing f45 v45, toField backendParams encode Nothing f46 v46, toField backendParams encode Nothing f47 v47]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25, o26, o27, o28, o29, o30, o31, o32, o33, o34, o35, o36, o37, o38, o39, o40, o41, o42, o43, o44, o45, o46, o47]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25, toField backendParams encode (Just o26) f26 v26, toField backendParams encode (Just o27) f27 v27, toField backendParams encode (Just o28) f28 v28, toField backendParams encode (Just o29) f29 v29, toField backendParams encode (Just o30) f30 v30, toField backendParams encode (Just o31) f31 v31, toField backendParams encode (Just o32) f32 v32, toField backendParams encode (Just o33) f33 v33, toField backendParams encode (Just o34) f34 v34, toField backendParams encode (Just o35) f35 v35, toField backendParams encode (Just o36) f36 v36, toField backendParams encode (Just o37) f37 v37, toField backendParams encode (Just o38) f38 v38, toField backendParams encode (Just o39) f39 v39, toField backendParams encode (Just o40) f40 v40, toField backendParams encode (Just o41) f41 v41, toField backendParams encode (Just o42) f42 v42, toField backendParams encode (Just o43) f43 v43, toField backendParams encode (Just o44) f44 v44, toField backendParams encode (Just o45) f45 v45, toField backendParams encode (Just o46) f46 v46, toField backendParams encode (Just o47) f47 v47]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 48, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 48, actually " <> show (length fs)++-- 49-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25, ToField i26, ToField i27, ToField i28, ToField i29, ToField i30, ToField i31, ToField i32, ToField i33, ToField i34, ToField i35, ToField i36, ToField i37, ToField i38, ToField i39, ToField i40, ToField i41, ToField i42, ToField i43, ToField i44, ToField i45, ToField i46, ToField i47, ToField i48) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25, toField backendParams encode Nothing f26 v26, toField backendParams encode Nothing f27 v27, toField backendParams encode Nothing f28 v28, toField backendParams encode Nothing f29 v29, toField backendParams encode Nothing f30 v30, toField backendParams encode Nothing f31 v31, toField backendParams encode Nothing f32 v32, toField backendParams encode Nothing f33 v33, toField backendParams encode Nothing f34 v34, toField backendParams encode Nothing f35 v35, toField backendParams encode Nothing f36 v36, toField backendParams encode Nothing f37 v37, toField backendParams encode Nothing f38 v38, toField backendParams encode Nothing f39 v39, toField backendParams encode Nothing f40 v40, toField backendParams encode Nothing f41 v41, toField backendParams encode Nothing f42 v42, toField backendParams encode Nothing f43 v43, toField backendParams encode Nothing f44 v44, toField backendParams encode Nothing f45 v45, toField backendParams encode Nothing f46 v46, toField backendParams encode Nothing f47 v47, toField backendParams encode Nothing f48 v48]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25, o26, o27, o28, o29, o30, o31, o32, o33, o34, o35, o36, o37, o38, o39, o40, o41, o42, o43, o44, o45, o46, o47, o48]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25, toField backendParams encode (Just o26) f26 v26, toField backendParams encode (Just o27) f27 v27, toField backendParams encode (Just o28) f28 v28, toField backendParams encode (Just o29) f29 v29, toField backendParams encode (Just o30) f30 v30, toField backendParams encode (Just o31) f31 v31, toField backendParams encode (Just o32) f32 v32, toField backendParams encode (Just o33) f33 v33, toField backendParams encode (Just o34) f34 v34, toField backendParams encode (Just o35) f35 v35, toField backendParams encode (Just o36) f36 v36, toField backendParams encode (Just o37) f37 v37, toField backendParams encode (Just o38) f38 v38, toField backendParams encode (Just o39) f39 v39, toField backendParams encode (Just o40) f40 v40, toField backendParams encode (Just o41) f41 v41, toField backendParams encode (Just o42) f42 v42, toField backendParams encode (Just o43) f43 v43, toField backendParams encode (Just o44) f44 v44, toField backendParams encode (Just o45) f45 v45, toField backendParams encode (Just o46) f46 v46, toField backendParams encode (Just o47) f47 v47, toField backendParams encode (Just o48) f48 v48]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 49, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 49, actually " <> show (length fs)++-- 50-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25, ToField i26, ToField i27, ToField i28, ToField i29, ToField i30, ToField i31, ToField i32, ToField i33, ToField i34, ToField i35, ToField i36, ToField i37, ToField i38, ToField i39, ToField i40, ToField i41, ToField i42, ToField i43, ToField i44, ToField i45, ToField i46, ToField i47, ToField i48, ToField i49) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25, toField backendParams encode Nothing f26 v26, toField backendParams encode Nothing f27 v27, toField backendParams encode Nothing f28 v28, toField backendParams encode Nothing f29 v29, toField backendParams encode Nothing f30 v30, toField backendParams encode Nothing f31 v31, toField backendParams encode Nothing f32 v32, toField backendParams encode Nothing f33 v33, toField backendParams encode Nothing f34 v34, toField backendParams encode Nothing f35 v35, toField backendParams encode Nothing f36 v36, toField backendParams encode Nothing f37 v37, toField backendParams encode Nothing f38 v38, toField backendParams encode Nothing f39 v39, toField backendParams encode Nothing f40 v40, toField backendParams encode Nothing f41 v41, toField backendParams encode Nothing f42 v42, toField backendParams encode Nothing f43 v43, toField backendParams encode Nothing f44 v44, toField backendParams encode Nothing f45 v45, toField backendParams encode Nothing f46 v46, toField backendParams encode Nothing f47 v47, toField backendParams encode Nothing f48 v48, toField backendParams encode Nothing f49 v49]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25, o26, o27, o28, o29, o30, o31, o32, o33, o34, o35, o36, o37, o38, o39, o40, o41, o42, o43, o44, o45, o46, o47, o48, o49]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25, toField backendParams encode (Just o26) f26 v26, toField backendParams encode (Just o27) f27 v27, toField backendParams encode (Just o28) f28 v28, toField backendParams encode (Just o29) f29 v29, toField backendParams encode (Just o30) f30 v30, toField backendParams encode (Just o31) f31 v31, toField backendParams encode (Just o32) f32 v32, toField backendParams encode (Just o33) f33 v33, toField backendParams encode (Just o34) f34 v34, toField backendParams encode (Just o35) f35 v35, toField backendParams encode (Just o36) f36 v36, toField backendParams encode (Just o37) f37 v37, toField backendParams encode (Just o38) f38 v38, toField backendParams encode (Just o39) f39 v39, toField backendParams encode (Just o40) f40 v40, toField backendParams encode (Just o41) f41 v41, toField backendParams encode (Just o42) f42 v42, toField backendParams encode (Just o43) f43 v43, toField backendParams encode (Just o44) f44 v44, toField backendParams encode (Just o45) f45 v45, toField backendParams encode (Just o46) f46 v46, toField backendParams encode (Just o47) f47 v47, toField backendParams encode (Just o48) f48 v48, toField backendParams encode (Just o49) f49 v49]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 50, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 50, actually " <> show (length fs)++-- 51-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25, ToField i26, ToField i27, ToField i28, ToField i29, ToField i30, ToField i31, ToField i32, ToField i33, ToField i34, ToField i35, ToField i36, ToField i37, ToField i38, ToField i39, ToField i40, ToField i41, ToField i42, ToField i43, ToField i44, ToField i45, ToField i46, ToField i47, ToField i48, ToField i49, ToField i50) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25, toField backendParams encode Nothing f26 v26, toField backendParams encode Nothing f27 v27, toField backendParams encode Nothing f28 v28, toField backendParams encode Nothing f29 v29, toField backendParams encode Nothing f30 v30, toField backendParams encode Nothing f31 v31, toField backendParams encode Nothing f32 v32, toField backendParams encode Nothing f33 v33, toField backendParams encode Nothing f34 v34, toField backendParams encode Nothing f35 v35, toField backendParams encode Nothing f36 v36, toField backendParams encode Nothing f37 v37, toField backendParams encode Nothing f38 v38, toField backendParams encode Nothing f39 v39, toField backendParams encode Nothing f40 v40, toField backendParams encode Nothing f41 v41, toField backendParams encode Nothing f42 v42, toField backendParams encode Nothing f43 v43, toField backendParams encode Nothing f44 v44, toField backendParams encode Nothing f45 v45, toField backendParams encode Nothing f46 v46, toField backendParams encode Nothing f47 v47, toField backendParams encode Nothing f48 v48, toField backendParams encode Nothing f49 v49, toField backendParams encode Nothing f50 v50]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25, o26, o27, o28, o29, o30, o31, o32, o33, o34, o35, o36, o37, o38, o39, o40, o41, o42, o43, o44, o45, o46, o47, o48, o49, o50]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25, toField backendParams encode (Just o26) f26 v26, toField backendParams encode (Just o27) f27 v27, toField backendParams encode (Just o28) f28 v28, toField backendParams encode (Just o29) f29 v29, toField backendParams encode (Just o30) f30 v30, toField backendParams encode (Just o31) f31 v31, toField backendParams encode (Just o32) f32 v32, toField backendParams encode (Just o33) f33 v33, toField backendParams encode (Just o34) f34 v34, toField backendParams encode (Just o35) f35 v35, toField backendParams encode (Just o36) f36 v36, toField backendParams encode (Just o37) f37 v37, toField backendParams encode (Just o38) f38 v38, toField backendParams encode (Just o39) f39 v39, toField backendParams encode (Just o40) f40 v40, toField backendParams encode (Just o41) f41 v41, toField backendParams encode (Just o42) f42 v42, toField backendParams encode (Just o43) f43 v43, toField backendParams encode (Just o44) f44 v44, toField backendParams encode (Just o45) f45 v45, toField backendParams encode (Just o46) f46 v46, toField backendParams encode (Just o47) f47 v47, toField backendParams encode (Just o48) f48 v48, toField backendParams encode (Just o49) f49 v49, toField backendParams encode (Just o50) f50 v50]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 51, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 51, actually " <> show (length fs)++-- 52-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25, ToField i26, ToField i27, ToField i28, ToField i29, ToField i30, ToField i31, ToField i32, ToField i33, ToField i34, ToField i35, ToField i36, ToField i37, ToField i38, ToField i39, ToField i40, ToField i41, ToField i42, ToField i43, ToField i44, ToField i45, ToField i46, ToField i47, ToField i48, ToField i49, ToField i50, ToField i51) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25, toField backendParams encode Nothing f26 v26, toField backendParams encode Nothing f27 v27, toField backendParams encode Nothing f28 v28, toField backendParams encode Nothing f29 v29, toField backendParams encode Nothing f30 v30, toField backendParams encode Nothing f31 v31, toField backendParams encode Nothing f32 v32, toField backendParams encode Nothing f33 v33, toField backendParams encode Nothing f34 v34, toField backendParams encode Nothing f35 v35, toField backendParams encode Nothing f36 v36, toField backendParams encode Nothing f37 v37, toField backendParams encode Nothing f38 v38, toField backendParams encode Nothing f39 v39, toField backendParams encode Nothing f40 v40, toField backendParams encode Nothing f41 v41, toField backendParams encode Nothing f42 v42, toField backendParams encode Nothing f43 v43, toField backendParams encode Nothing f44 v44, toField backendParams encode Nothing f45 v45, toField backendParams encode Nothing f46 v46, toField backendParams encode Nothing f47 v47, toField backendParams encode Nothing f48 v48, toField backendParams encode Nothing f49 v49, toField backendParams encode Nothing f50 v50, toField backendParams encode Nothing f51 v51]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25, o26, o27, o28, o29, o30, o31, o32, o33, o34, o35, o36, o37, o38, o39, o40, o41, o42, o43, o44, o45, o46, o47, o48, o49, o50, o51]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25, toField backendParams encode (Just o26) f26 v26, toField backendParams encode (Just o27) f27 v27, toField backendParams encode (Just o28) f28 v28, toField backendParams encode (Just o29) f29 v29, toField backendParams encode (Just o30) f30 v30, toField backendParams encode (Just o31) f31 v31, toField backendParams encode (Just o32) f32 v32, toField backendParams encode (Just o33) f33 v33, toField backendParams encode (Just o34) f34 v34, toField backendParams encode (Just o35) f35 v35, toField backendParams encode (Just o36) f36 v36, toField backendParams encode (Just o37) f37 v37, toField backendParams encode (Just o38) f38 v38, toField backendParams encode (Just o39) f39 v39, toField backendParams encode (Just o40) f40 v40, toField backendParams encode (Just o41) f41 v41, toField backendParams encode (Just o42) f42 v42, toField backendParams encode (Just o43) f43 v43, toField backendParams encode (Just o44) f44 v44, toField backendParams encode (Just o45) f45 v45, toField backendParams encode (Just o46) f46 v46, toField backendParams encode (Just o47) f47 v47, toField backendParams encode (Just o48) f48 v48, toField backendParams encode (Just o49) f49 v49, toField backendParams encode (Just o50) f50 v50, toField backendParams encode (Just o51) f51 v51]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 52, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 52, actually " <> show (length fs)++-- 53-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25, ToField i26, ToField i27, ToField i28, ToField i29, ToField i30, ToField i31, ToField i32, ToField i33, ToField i34, ToField i35, ToField i36, ToField i37, ToField i38, ToField i39, ToField i40, ToField i41, ToField i42, ToField i43, ToField i44, ToField i45, ToField i46, ToField i47, ToField i48, ToField i49, ToField i50, ToField i51, ToField i52) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25, toField backendParams encode Nothing f26 v26, toField backendParams encode Nothing f27 v27, toField backendParams encode Nothing f28 v28, toField backendParams encode Nothing f29 v29, toField backendParams encode Nothing f30 v30, toField backendParams encode Nothing f31 v31, toField backendParams encode Nothing f32 v32, toField backendParams encode Nothing f33 v33, toField backendParams encode Nothing f34 v34, toField backendParams encode Nothing f35 v35, toField backendParams encode Nothing f36 v36, toField backendParams encode Nothing f37 v37, toField backendParams encode Nothing f38 v38, toField backendParams encode Nothing f39 v39, toField backendParams encode Nothing f40 v40, toField backendParams encode Nothing f41 v41, toField backendParams encode Nothing f42 v42, toField backendParams encode Nothing f43 v43, toField backendParams encode Nothing f44 v44, toField backendParams encode Nothing f45 v45, toField backendParams encode Nothing f46 v46, toField backendParams encode Nothing f47 v47, toField backendParams encode Nothing f48 v48, toField backendParams encode Nothing f49 v49, toField backendParams encode Nothing f50 v50, toField backendParams encode Nothing f51 v51, toField backendParams encode Nothing f52 v52]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25, o26, o27, o28, o29, o30, o31, o32, o33, o34, o35, o36, o37, o38, o39, o40, o41, o42, o43, o44, o45, o46, o47, o48, o49, o50, o51, o52]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25, toField backendParams encode (Just o26) f26 v26, toField backendParams encode (Just o27) f27 v27, toField backendParams encode (Just o28) f28 v28, toField backendParams encode (Just o29) f29 v29, toField backendParams encode (Just o30) f30 v30, toField backendParams encode (Just o31) f31 v31, toField backendParams encode (Just o32) f32 v32, toField backendParams encode (Just o33) f33 v33, toField backendParams encode (Just o34) f34 v34, toField backendParams encode (Just o35) f35 v35, toField backendParams encode (Just o36) f36 v36, toField backendParams encode (Just o37) f37 v37, toField backendParams encode (Just o38) f38 v38, toField backendParams encode (Just o39) f39 v39, toField backendParams encode (Just o40) f40 v40, toField backendParams encode (Just o41) f41 v41, toField backendParams encode (Just o42) f42 v42, toField backendParams encode (Just o43) f43 v43, toField backendParams encode (Just o44) f44 v44, toField backendParams encode (Just o45) f45 v45, toField backendParams encode (Just o46) f46 v46, toField backendParams encode (Just o47) f47 v47, toField backendParams encode (Just o48) f48 v48, toField backendParams encode (Just o49) f49 v49, toField backendParams encode (Just o50) f50 v50, toField backendParams encode (Just o51) f51 v51, toField backendParams encode (Just o52) f52 v52]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 53, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 53, actually " <> show (length fs)++-- 54-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25, ToField i26, ToField i27, ToField i28, ToField i29, ToField i30, ToField i31, ToField i32, ToField i33, ToField i34, ToField i35, ToField i36, ToField i37, ToField i38, ToField i39, ToField i40, ToField i41, ToField i42, ToField i43, ToField i44, ToField i45, ToField i46, ToField i47, ToField i48, ToField i49, ToField i50, ToField i51, ToField i52, ToField i53) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52, i53) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25, toField backendParams encode Nothing f26 v26, toField backendParams encode Nothing f27 v27, toField backendParams encode Nothing f28 v28, toField backendParams encode Nothing f29 v29, toField backendParams encode Nothing f30 v30, toField backendParams encode Nothing f31 v31, toField backendParams encode Nothing f32 v32, toField backendParams encode Nothing f33 v33, toField backendParams encode Nothing f34 v34, toField backendParams encode Nothing f35 v35, toField backendParams encode Nothing f36 v36, toField backendParams encode Nothing f37 v37, toField backendParams encode Nothing f38 v38, toField backendParams encode Nothing f39 v39, toField backendParams encode Nothing f40 v40, toField backendParams encode Nothing f41 v41, toField backendParams encode Nothing f42 v42, toField backendParams encode Nothing f43 v43, toField backendParams encode Nothing f44 v44, toField backendParams encode Nothing f45 v45, toField backendParams encode Nothing f46 v46, toField backendParams encode Nothing f47 v47, toField backendParams encode Nothing f48 v48, toField backendParams encode Nothing f49 v49, toField backendParams encode Nothing f50 v50, toField backendParams encode Nothing f51 v51, toField backendParams encode Nothing f52 v52, toField backendParams encode Nothing f53 v53]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25, o26, o27, o28, o29, o30, o31, o32, o33, o34, o35, o36, o37, o38, o39, o40, o41, o42, o43, o44, o45, o46, o47, o48, o49, o50, o51, o52, o53]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25, toField backendParams encode (Just o26) f26 v26, toField backendParams encode (Just o27) f27 v27, toField backendParams encode (Just o28) f28 v28, toField backendParams encode (Just o29) f29 v29, toField backendParams encode (Just o30) f30 v30, toField backendParams encode (Just o31) f31 v31, toField backendParams encode (Just o32) f32 v32, toField backendParams encode (Just o33) f33 v33, toField backendParams encode (Just o34) f34 v34, toField backendParams encode (Just o35) f35 v35, toField backendParams encode (Just o36) f36 v36, toField backendParams encode (Just o37) f37 v37, toField backendParams encode (Just o38) f38 v38, toField backendParams encode (Just o39) f39 v39, toField backendParams encode (Just o40) f40 v40, toField backendParams encode (Just o41) f41 v41, toField backendParams encode (Just o42) f42 v42, toField backendParams encode (Just o43) f43 v43, toField backendParams encode (Just o44) f44 v44, toField backendParams encode (Just o45) f45 v45, toField backendParams encode (Just o46) f46 v46, toField backendParams encode (Just o47) f47 v47, toField backendParams encode (Just o48) f48 v48, toField backendParams encode (Just o49) f49 v49, toField backendParams encode (Just o50) f50 v50, toField backendParams encode (Just o51) f51 v51, toField backendParams encode (Just o52) f52 v52, toField backendParams encode (Just o53) f53 v53]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 54, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 54, actually " <> show (length fs)++-- 55-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25, ToField i26, ToField i27, ToField i28, ToField i29, ToField i30, ToField i31, ToField i32, ToField i33, ToField i34, ToField i35, ToField i36, ToField i37, ToField i38, ToField i39, ToField i40, ToField i41, ToField i42, ToField i43, ToField i44, ToField i45, ToField i46, ToField i47, ToField i48, ToField i49, ToField i50, ToField i51, ToField i52, ToField i53, ToField i54) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52, i53, i54) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25, toField backendParams encode Nothing f26 v26, toField backendParams encode Nothing f27 v27, toField backendParams encode Nothing f28 v28, toField backendParams encode Nothing f29 v29, toField backendParams encode Nothing f30 v30, toField backendParams encode Nothing f31 v31, toField backendParams encode Nothing f32 v32, toField backendParams encode Nothing f33 v33, toField backendParams encode Nothing f34 v34, toField backendParams encode Nothing f35 v35, toField backendParams encode Nothing f36 v36, toField backendParams encode Nothing f37 v37, toField backendParams encode Nothing f38 v38, toField backendParams encode Nothing f39 v39, toField backendParams encode Nothing f40 v40, toField backendParams encode Nothing f41 v41, toField backendParams encode Nothing f42 v42, toField backendParams encode Nothing f43 v43, toField backendParams encode Nothing f44 v44, toField backendParams encode Nothing f45 v45, toField backendParams encode Nothing f46 v46, toField backendParams encode Nothing f47 v47, toField backendParams encode Nothing f48 v48, toField backendParams encode Nothing f49 v49, toField backendParams encode Nothing f50 v50, toField backendParams encode Nothing f51 v51, toField backendParams encode Nothing f52 v52, toField backendParams encode Nothing f53 v53, toField backendParams encode Nothing f54 v54]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25, o26, o27, o28, o29, o30, o31, o32, o33, o34, o35, o36, o37, o38, o39, o40, o41, o42, o43, o44, o45, o46, o47, o48, o49, o50, o51, o52, o53, o54]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25, toField backendParams encode (Just o26) f26 v26, toField backendParams encode (Just o27) f27 v27, toField backendParams encode (Just o28) f28 v28, toField backendParams encode (Just o29) f29 v29, toField backendParams encode (Just o30) f30 v30, toField backendParams encode (Just o31) f31 v31, toField backendParams encode (Just o32) f32 v32, toField backendParams encode (Just o33) f33 v33, toField backendParams encode (Just o34) f34 v34, toField backendParams encode (Just o35) f35 v35, toField backendParams encode (Just o36) f36 v36, toField backendParams encode (Just o37) f37 v37, toField backendParams encode (Just o38) f38 v38, toField backendParams encode (Just o39) f39 v39, toField backendParams encode (Just o40) f40 v40, toField backendParams encode (Just o41) f41 v41, toField backendParams encode (Just o42) f42 v42, toField backendParams encode (Just o43) f43 v43, toField backendParams encode (Just o44) f44 v44, toField backendParams encode (Just o45) f45 v45, toField backendParams encode (Just o46) f46 v46, toField backendParams encode (Just o47) f47 v47, toField backendParams encode (Just o48) f48 v48, toField backendParams encode (Just o49) f49 v49, toField backendParams encode (Just o50) f50 v50, toField backendParams encode (Just o51) f51 v51, toField backendParams encode (Just o52) f52 v52, toField backendParams encode (Just o53) f53 v53, toField backendParams encode (Just o54) f54 v54]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 55, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 55, actually " <> show (length fs)++-- 56-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25, ToField i26, ToField i27, ToField i28, ToField i29, ToField i30, ToField i31, ToField i32, ToField i33, ToField i34, ToField i35, ToField i36, ToField i37, ToField i38, ToField i39, ToField i40, ToField i41, ToField i42, ToField i43, ToField i44, ToField i45, ToField i46, ToField i47, ToField i48, ToField i49, ToField i50, ToField i51, ToField i52, ToField i53, ToField i54, ToField i55) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52, i53, i54, i55) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25, toField backendParams encode Nothing f26 v26, toField backendParams encode Nothing f27 v27, toField backendParams encode Nothing f28 v28, toField backendParams encode Nothing f29 v29, toField backendParams encode Nothing f30 v30, toField backendParams encode Nothing f31 v31, toField backendParams encode Nothing f32 v32, toField backendParams encode Nothing f33 v33, toField backendParams encode Nothing f34 v34, toField backendParams encode Nothing f35 v35, toField backendParams encode Nothing f36 v36, toField backendParams encode Nothing f37 v37, toField backendParams encode Nothing f38 v38, toField backendParams encode Nothing f39 v39, toField backendParams encode Nothing f40 v40, toField backendParams encode Nothing f41 v41, toField backendParams encode Nothing f42 v42, toField backendParams encode Nothing f43 v43, toField backendParams encode Nothing f44 v44, toField backendParams encode Nothing f45 v45, toField backendParams encode Nothing f46 v46, toField backendParams encode Nothing f47 v47, toField backendParams encode Nothing f48 v48, toField backendParams encode Nothing f49 v49, toField backendParams encode Nothing f50 v50, toField backendParams encode Nothing f51 v51, toField backendParams encode Nothing f52 v52, toField backendParams encode Nothing f53 v53, toField backendParams encode Nothing f54 v54, toField backendParams encode Nothing f55 v55]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25, o26, o27, o28, o29, o30, o31, o32, o33, o34, o35, o36, o37, o38, o39, o40, o41, o42, o43, o44, o45, o46, o47, o48, o49, o50, o51, o52, o53, o54, o55]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25, toField backendParams encode (Just o26) f26 v26, toField backendParams encode (Just o27) f27 v27, toField backendParams encode (Just o28) f28 v28, toField backendParams encode (Just o29) f29 v29, toField backendParams encode (Just o30) f30 v30, toField backendParams encode (Just o31) f31 v31, toField backendParams encode (Just o32) f32 v32, toField backendParams encode (Just o33) f33 v33, toField backendParams encode (Just o34) f34 v34, toField backendParams encode (Just o35) f35 v35, toField backendParams encode (Just o36) f36 v36, toField backendParams encode (Just o37) f37 v37, toField backendParams encode (Just o38) f38 v38, toField backendParams encode (Just o39) f39 v39, toField backendParams encode (Just o40) f40 v40, toField backendParams encode (Just o41) f41 v41, toField backendParams encode (Just o42) f42 v42, toField backendParams encode (Just o43) f43 v43, toField backendParams encode (Just o44) f44 v44, toField backendParams encode (Just o45) f45 v45, toField backendParams encode (Just o46) f46 v46, toField backendParams encode (Just o47) f47 v47, toField backendParams encode (Just o48) f48 v48, toField backendParams encode (Just o49) f49 v49, toField backendParams encode (Just o50) f50 v50, toField backendParams encode (Just o51) f51 v51, toField backendParams encode (Just o52) f52 v52, toField backendParams encode (Just o53) f53 v53, toField backendParams encode (Just o54) f54 v54, toField backendParams encode (Just o55) f55 v55]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 56, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 56, actually " <> show (length fs)++-- 57-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25, ToField i26, ToField i27, ToField i28, ToField i29, ToField i30, ToField i31, ToField i32, ToField i33, ToField i34, ToField i35, ToField i36, ToField i37, ToField i38, ToField i39, ToField i40, ToField i41, ToField i42, ToField i43, ToField i44, ToField i45, ToField i46, ToField i47, ToField i48, ToField i49, ToField i50, ToField i51, ToField i52, ToField i53, ToField i54, ToField i55, ToField i56) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52, i53, i54, i55, i56) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25, toField backendParams encode Nothing f26 v26, toField backendParams encode Nothing f27 v27, toField backendParams encode Nothing f28 v28, toField backendParams encode Nothing f29 v29, toField backendParams encode Nothing f30 v30, toField backendParams encode Nothing f31 v31, toField backendParams encode Nothing f32 v32, toField backendParams encode Nothing f33 v33, toField backendParams encode Nothing f34 v34, toField backendParams encode Nothing f35 v35, toField backendParams encode Nothing f36 v36, toField backendParams encode Nothing f37 v37, toField backendParams encode Nothing f38 v38, toField backendParams encode Nothing f39 v39, toField backendParams encode Nothing f40 v40, toField backendParams encode Nothing f41 v41, toField backendParams encode Nothing f42 v42, toField backendParams encode Nothing f43 v43, toField backendParams encode Nothing f44 v44, toField backendParams encode Nothing f45 v45, toField backendParams encode Nothing f46 v46, toField backendParams encode Nothing f47 v47, toField backendParams encode Nothing f48 v48, toField backendParams encode Nothing f49 v49, toField backendParams encode Nothing f50 v50, toField backendParams encode Nothing f51 v51, toField backendParams encode Nothing f52 v52, toField backendParams encode Nothing f53 v53, toField backendParams encode Nothing f54 v54, toField backendParams encode Nothing f55 v55, toField backendParams encode Nothing f56 v56]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25, o26, o27, o28, o29, o30, o31, o32, o33, o34, o35, o36, o37, o38, o39, o40, o41, o42, o43, o44, o45, o46, o47, o48, o49, o50, o51, o52, o53, o54, o55, o56]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25, toField backendParams encode (Just o26) f26 v26, toField backendParams encode (Just o27) f27 v27, toField backendParams encode (Just o28) f28 v28, toField backendParams encode (Just o29) f29 v29, toField backendParams encode (Just o30) f30 v30, toField backendParams encode (Just o31) f31 v31, toField backendParams encode (Just o32) f32 v32, toField backendParams encode (Just o33) f33 v33, toField backendParams encode (Just o34) f34 v34, toField backendParams encode (Just o35) f35 v35, toField backendParams encode (Just o36) f36 v36, toField backendParams encode (Just o37) f37 v37, toField backendParams encode (Just o38) f38 v38, toField backendParams encode (Just o39) f39 v39, toField backendParams encode (Just o40) f40 v40, toField backendParams encode (Just o41) f41 v41, toField backendParams encode (Just o42) f42 v42, toField backendParams encode (Just o43) f43 v43, toField backendParams encode (Just o44) f44 v44, toField backendParams encode (Just o45) f45 v45, toField backendParams encode (Just o46) f46 v46, toField backendParams encode (Just o47) f47 v47, toField backendParams encode (Just o48) f48 v48, toField backendParams encode (Just o49) f49 v49, toField backendParams encode (Just o50) f50 v50, toField backendParams encode (Just o51) f51 v51, toField backendParams encode (Just o52) f52 v52, toField backendParams encode (Just o53) f53 v53, toField backendParams encode (Just o54) f54 v54, toField backendParams encode (Just o55) f55 v55, toField backendParams encode (Just o56) f56 v56]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 57, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 57, actually " <> show (length fs)++-- 58-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25, ToField i26, ToField i27, ToField i28, ToField i29, ToField i30, ToField i31, ToField i32, ToField i33, ToField i34, ToField i35, ToField i36, ToField i37, ToField i38, ToField i39, ToField i40, ToField i41, ToField i42, ToField i43, ToField i44, ToField i45, ToField i46, ToField i47, ToField i48, ToField i49, ToField i50, ToField i51, ToField i52, ToField i53, ToField i54, ToField i55, ToField i56, ToField i57) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52, i53, i54, i55, i56, i57) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25, toField backendParams encode Nothing f26 v26, toField backendParams encode Nothing f27 v27, toField backendParams encode Nothing f28 v28, toField backendParams encode Nothing f29 v29, toField backendParams encode Nothing f30 v30, toField backendParams encode Nothing f31 v31, toField backendParams encode Nothing f32 v32, toField backendParams encode Nothing f33 v33, toField backendParams encode Nothing f34 v34, toField backendParams encode Nothing f35 v35, toField backendParams encode Nothing f36 v36, toField backendParams encode Nothing f37 v37, toField backendParams encode Nothing f38 v38, toField backendParams encode Nothing f39 v39, toField backendParams encode Nothing f40 v40, toField backendParams encode Nothing f41 v41, toField backendParams encode Nothing f42 v42, toField backendParams encode Nothing f43 v43, toField backendParams encode Nothing f44 v44, toField backendParams encode Nothing f45 v45, toField backendParams encode Nothing f46 v46, toField backendParams encode Nothing f47 v47, toField backendParams encode Nothing f48 v48, toField backendParams encode Nothing f49 v49, toField backendParams encode Nothing f50 v50, toField backendParams encode Nothing f51 v51, toField backendParams encode Nothing f52 v52, toField backendParams encode Nothing f53 v53, toField backendParams encode Nothing f54 v54, toField backendParams encode Nothing f55 v55, toField backendParams encode Nothing f56 v56, toField backendParams encode Nothing f57 v57]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25, o26, o27, o28, o29, o30, o31, o32, o33, o34, o35, o36, o37, o38, o39, o40, o41, o42, o43, o44, o45, o46, o47, o48, o49, o50, o51, o52, o53, o54, o55, o56, o57]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25, toField backendParams encode (Just o26) f26 v26, toField backendParams encode (Just o27) f27 v27, toField backendParams encode (Just o28) f28 v28, toField backendParams encode (Just o29) f29 v29, toField backendParams encode (Just o30) f30 v30, toField backendParams encode (Just o31) f31 v31, toField backendParams encode (Just o32) f32 v32, toField backendParams encode (Just o33) f33 v33, toField backendParams encode (Just o34) f34 v34, toField backendParams encode (Just o35) f35 v35, toField backendParams encode (Just o36) f36 v36, toField backendParams encode (Just o37) f37 v37, toField backendParams encode (Just o38) f38 v38, toField backendParams encode (Just o39) f39 v39, toField backendParams encode (Just o40) f40 v40, toField backendParams encode (Just o41) f41 v41, toField backendParams encode (Just o42) f42 v42, toField backendParams encode (Just o43) f43 v43, toField backendParams encode (Just o44) f44 v44, toField backendParams encode (Just o45) f45 v45, toField backendParams encode (Just o46) f46 v46, toField backendParams encode (Just o47) f47 v47, toField backendParams encode (Just o48) f48 v48, toField backendParams encode (Just o49) f49 v49, toField backendParams encode (Just o50) f50 v50, toField backendParams encode (Just o51) f51 v51, toField backendParams encode (Just o52) f52 v52, toField backendParams encode (Just o53) f53 v53, toField backendParams encode (Just o54) f54 v54, toField backendParams encode (Just o55) f55 v55, toField backendParams encode (Just o56) f56 v56, toField backendParams encode (Just o57) f57 v57]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 58, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 58, actually " <> show (length fs)++-- 59-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25, ToField i26, ToField i27, ToField i28, ToField i29, ToField i30, ToField i31, ToField i32, ToField i33, ToField i34, ToField i35, ToField i36, ToField i37, ToField i38, ToField i39, ToField i40, ToField i41, ToField i42, ToField i43, ToField i44, ToField i45, ToField i46, ToField i47, ToField i48, ToField i49, ToField i50, ToField i51, ToField i52, ToField i53, ToField i54, ToField i55, ToField i56, ToField i57, ToField i58) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52, i53, i54, i55, i56, i57, i58) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25, toField backendParams encode Nothing f26 v26, toField backendParams encode Nothing f27 v27, toField backendParams encode Nothing f28 v28, toField backendParams encode Nothing f29 v29, toField backendParams encode Nothing f30 v30, toField backendParams encode Nothing f31 v31, toField backendParams encode Nothing f32 v32, toField backendParams encode Nothing f33 v33, toField backendParams encode Nothing f34 v34, toField backendParams encode Nothing f35 v35, toField backendParams encode Nothing f36 v36, toField backendParams encode Nothing f37 v37, toField backendParams encode Nothing f38 v38, toField backendParams encode Nothing f39 v39, toField backendParams encode Nothing f40 v40, toField backendParams encode Nothing f41 v41, toField backendParams encode Nothing f42 v42, toField backendParams encode Nothing f43 v43, toField backendParams encode Nothing f44 v44, toField backendParams encode Nothing f45 v45, toField backendParams encode Nothing f46 v46, toField backendParams encode Nothing f47 v47, toField backendParams encode Nothing f48 v48, toField backendParams encode Nothing f49 v49, toField backendParams encode Nothing f50 v50, toField backendParams encode Nothing f51 v51, toField backendParams encode Nothing f52 v52, toField backendParams encode Nothing f53 v53, toField backendParams encode Nothing f54 v54, toField backendParams encode Nothing f55 v55, toField backendParams encode Nothing f56 v56, toField backendParams encode Nothing f57 v57, toField backendParams encode Nothing f58 v58]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25, o26, o27, o28, o29, o30, o31, o32, o33, o34, o35, o36, o37, o38, o39, o40, o41, o42, o43, o44, o45, o46, o47, o48, o49, o50, o51, o52, o53, o54, o55, o56, o57, o58]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25, toField backendParams encode (Just o26) f26 v26, toField backendParams encode (Just o27) f27 v27, toField backendParams encode (Just o28) f28 v28, toField backendParams encode (Just o29) f29 v29, toField backendParams encode (Just o30) f30 v30, toField backendParams encode (Just o31) f31 v31, toField backendParams encode (Just o32) f32 v32, toField backendParams encode (Just o33) f33 v33, toField backendParams encode (Just o34) f34 v34, toField backendParams encode (Just o35) f35 v35, toField backendParams encode (Just o36) f36 v36, toField backendParams encode (Just o37) f37 v37, toField backendParams encode (Just o38) f38 v38, toField backendParams encode (Just o39) f39 v39, toField backendParams encode (Just o40) f40 v40, toField backendParams encode (Just o41) f41 v41, toField backendParams encode (Just o42) f42 v42, toField backendParams encode (Just o43) f43 v43, toField backendParams encode (Just o44) f44 v44, toField backendParams encode (Just o45) f45 v45, toField backendParams encode (Just o46) f46 v46, toField backendParams encode (Just o47) f47 v47, toField backendParams encode (Just o48) f48 v48, toField backendParams encode (Just o49) f49 v49, toField backendParams encode (Just o50) f50 v50, toField backendParams encode (Just o51) f51 v51, toField backendParams encode (Just o52) f52 v52, toField backendParams encode (Just o53) f53 v53, toField backendParams encode (Just o54) f54 v54, toField backendParams encode (Just o55) f55 v55, toField backendParams encode (Just o56) f56 v56, toField backendParams encode (Just o57) f57 v57, toField backendParams encode (Just o58) f58 v58]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 59, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 59, actually " <> show (length fs)++-- 60-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25, ToField i26, ToField i27, ToField i28, ToField i29, ToField i30, ToField i31, ToField i32, ToField i33, ToField i34, ToField i35, ToField i36, ToField i37, ToField i38, ToField i39, ToField i40, ToField i41, ToField i42, ToField i43, ToField i44, ToField i45, ToField i46, ToField i47, ToField i48, ToField i49, ToField i50, ToField i51, ToField i52, ToField i53, ToField i54, ToField i55, ToField i56, ToField i57, ToField i58, ToField i59) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52, i53, i54, i55, i56, i57, i58, i59) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58, f59] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25, toField backendParams encode Nothing f26 v26, toField backendParams encode Nothing f27 v27, toField backendParams encode Nothing f28 v28, toField backendParams encode Nothing f29 v29, toField backendParams encode Nothing f30 v30, toField backendParams encode Nothing f31 v31, toField backendParams encode Nothing f32 v32, toField backendParams encode Nothing f33 v33, toField backendParams encode Nothing f34 v34, toField backendParams encode Nothing f35 v35, toField backendParams encode Nothing f36 v36, toField backendParams encode Nothing f37 v37, toField backendParams encode Nothing f38 v38, toField backendParams encode Nothing f39 v39, toField backendParams encode Nothing f40 v40, toField backendParams encode Nothing f41 v41, toField backendParams encode Nothing f42 v42, toField backendParams encode Nothing f43 v43, toField backendParams encode Nothing f44 v44, toField backendParams encode Nothing f45 v45, toField backendParams encode Nothing f46 v46, toField backendParams encode Nothing f47 v47, toField backendParams encode Nothing f48 v48, toField backendParams encode Nothing f49 v49, toField backendParams encode Nothing f50 v50, toField backendParams encode Nothing f51 v51, toField backendParams encode Nothing f52 v52, toField backendParams encode Nothing f53 v53, toField backendParams encode Nothing f54 v54, toField backendParams encode Nothing f55 v55, toField backendParams encode Nothing f56 v56, toField backendParams encode Nothing f57 v57, toField backendParams encode Nothing f58 v58, toField backendParams encode Nothing f59 v59]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25, o26, o27, o28, o29, o30, o31, o32, o33, o34, o35, o36, o37, o38, o39, o40, o41, o42, o43, o44, o45, o46, o47, o48, o49, o50, o51, o52, o53, o54, o55, o56, o57, o58, o59]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58, f59] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25, toField backendParams encode (Just o26) f26 v26, toField backendParams encode (Just o27) f27 v27, toField backendParams encode (Just o28) f28 v28, toField backendParams encode (Just o29) f29 v29, toField backendParams encode (Just o30) f30 v30, toField backendParams encode (Just o31) f31 v31, toField backendParams encode (Just o32) f32 v32, toField backendParams encode (Just o33) f33 v33, toField backendParams encode (Just o34) f34 v34, toField backendParams encode (Just o35) f35 v35, toField backendParams encode (Just o36) f36 v36, toField backendParams encode (Just o37) f37 v37, toField backendParams encode (Just o38) f38 v38, toField backendParams encode (Just o39) f39 v39, toField backendParams encode (Just o40) f40 v40, toField backendParams encode (Just o41) f41 v41, toField backendParams encode (Just o42) f42 v42, toField backendParams encode (Just o43) f43 v43, toField backendParams encode (Just o44) f44 v44, toField backendParams encode (Just o45) f45 v45, toField backendParams encode (Just o46) f46 v46, toField backendParams encode (Just o47) f47 v47, toField backendParams encode (Just o48) f48 v48, toField backendParams encode (Just o49) f49 v49, toField backendParams encode (Just o50) f50 v50, toField backendParams encode (Just o51) f51 v51, toField backendParams encode (Just o52) f52 v52, toField backendParams encode (Just o53) f53 v53, toField backendParams encode (Just o54) f54 v54, toField backendParams encode (Just o55) f55 v55, toField backendParams encode (Just o56) f56 v56, toField backendParams encode (Just o57) f57 v57, toField backendParams encode (Just o58) f58 v58, toField backendParams encode (Just o59) f59 v59]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 60, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 60, actually " <> show (length fs)++-- 61-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25, ToField i26, ToField i27, ToField i28, ToField i29, ToField i30, ToField i31, ToField i32, ToField i33, ToField i34, ToField i35, ToField i36, ToField i37, ToField i38, ToField i39, ToField i40, ToField i41, ToField i42, ToField i43, ToField i44, ToField i45, ToField i46, ToField i47, ToField i48, ToField i49, ToField i50, ToField i51, ToField i52, ToField i53, ToField i54, ToField i55, ToField i56, ToField i57, ToField i58, ToField i59, ToField i60) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52, i53, i54, i55, i56, i57, i58, i59, i60) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58, f59, f60] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25, toField backendParams encode Nothing f26 v26, toField backendParams encode Nothing f27 v27, toField backendParams encode Nothing f28 v28, toField backendParams encode Nothing f29 v29, toField backendParams encode Nothing f30 v30, toField backendParams encode Nothing f31 v31, toField backendParams encode Nothing f32 v32, toField backendParams encode Nothing f33 v33, toField backendParams encode Nothing f34 v34, toField backendParams encode Nothing f35 v35, toField backendParams encode Nothing f36 v36, toField backendParams encode Nothing f37 v37, toField backendParams encode Nothing f38 v38, toField backendParams encode Nothing f39 v39, toField backendParams encode Nothing f40 v40, toField backendParams encode Nothing f41 v41, toField backendParams encode Nothing f42 v42, toField backendParams encode Nothing f43 v43, toField backendParams encode Nothing f44 v44, toField backendParams encode Nothing f45 v45, toField backendParams encode Nothing f46 v46, toField backendParams encode Nothing f47 v47, toField backendParams encode Nothing f48 v48, toField backendParams encode Nothing f49 v49, toField backendParams encode Nothing f50 v50, toField backendParams encode Nothing f51 v51, toField backendParams encode Nothing f52 v52, toField backendParams encode Nothing f53 v53, toField backendParams encode Nothing f54 v54, toField backendParams encode Nothing f55 v55, toField backendParams encode Nothing f56 v56, toField backendParams encode Nothing f57 v57, toField backendParams encode Nothing f58 v58, toField backendParams encode Nothing f59 v59, toField backendParams encode Nothing f60 v60]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25, o26, o27, o28, o29, o30, o31, o32, o33, o34, o35, o36, o37, o38, o39, o40, o41, o42, o43, o44, o45, o46, o47, o48, o49, o50, o51, o52, o53, o54, o55, o56, o57, o58, o59, o60]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58, f59, f60] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25, toField backendParams encode (Just o26) f26 v26, toField backendParams encode (Just o27) f27 v27, toField backendParams encode (Just o28) f28 v28, toField backendParams encode (Just o29) f29 v29, toField backendParams encode (Just o30) f30 v30, toField backendParams encode (Just o31) f31 v31, toField backendParams encode (Just o32) f32 v32, toField backendParams encode (Just o33) f33 v33, toField backendParams encode (Just o34) f34 v34, toField backendParams encode (Just o35) f35 v35, toField backendParams encode (Just o36) f36 v36, toField backendParams encode (Just o37) f37 v37, toField backendParams encode (Just o38) f38 v38, toField backendParams encode (Just o39) f39 v39, toField backendParams encode (Just o40) f40 v40, toField backendParams encode (Just o41) f41 v41, toField backendParams encode (Just o42) f42 v42, toField backendParams encode (Just o43) f43 v43, toField backendParams encode (Just o44) f44 v44, toField backendParams encode (Just o45) f45 v45, toField backendParams encode (Just o46) f46 v46, toField backendParams encode (Just o47) f47 v47, toField backendParams encode (Just o48) f48 v48, toField backendParams encode (Just o49) f49 v49, toField backendParams encode (Just o50) f50 v50, toField backendParams encode (Just o51) f51 v51, toField backendParams encode (Just o52) f52 v52, toField backendParams encode (Just o53) f53 v53, toField backendParams encode (Just o54) f54 v54, toField backendParams encode (Just o55) f55 v55, toField backendParams encode (Just o56) f56 v56, toField backendParams encode (Just o57) f57 v57, toField backendParams encode (Just o58) f58 v58, toField backendParams encode (Just o59) f59 v59, toField backendParams encode (Just o60) f60 v60]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 61, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 61, actually " <> show (length fs)++-- 62-tuple+instance (ToField i0, ToField i1, ToField i2, ToField i3, ToField i4, ToField i5, ToField i6, ToField i7, ToField i8, ToField i9, ToField i10, ToField i11, ToField i12, ToField i13, ToField i14, ToField i15, ToField i16, ToField i17, ToField i18, ToField i19, ToField i20, ToField i21, ToField i22, ToField i23, ToField i24, ToField i25, ToField i26, ToField i27, ToField i28, ToField i29, ToField i30, ToField i31, ToField i32, ToField i33, ToField i34, ToField i35, ToField i36, ToField i37, ToField i38, ToField i39, ToField i40, ToField i41, ToField i42, ToField i43, ToField i44, ToField i45, ToField i46, ToField i47, ToField i48, ToField i49, ToField i50, ToField i51, ToField i52, ToField i53, ToField i54, ToField i55, ToField i56, ToField i57, ToField i58, ToField i59, ToField i60, ToField i61) => ToRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52, i53, i54, i55, i56, i57, i58, i59, i60, i61) where+ toRecord backendParams encode Nothing [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58, f59, f60, f61] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61) =+ sequence [toField backendParams encode Nothing f0 v0, toField backendParams encode Nothing f1 v1, toField backendParams encode Nothing f2 v2, toField backendParams encode Nothing f3 v3, toField backendParams encode Nothing f4 v4, toField backendParams encode Nothing f5 v5, toField backendParams encode Nothing f6 v6, toField backendParams encode Nothing f7 v7, toField backendParams encode Nothing f8 v8, toField backendParams encode Nothing f9 v9, toField backendParams encode Nothing f10 v10, toField backendParams encode Nothing f11 v11, toField backendParams encode Nothing f12 v12, toField backendParams encode Nothing f13 v13, toField backendParams encode Nothing f14 v14, toField backendParams encode Nothing f15 v15, toField backendParams encode Nothing f16 v16, toField backendParams encode Nothing f17 v17, toField backendParams encode Nothing f18 v18, toField backendParams encode Nothing f19 v19, toField backendParams encode Nothing f20 v20, toField backendParams encode Nothing f21 v21, toField backendParams encode Nothing f22 v22, toField backendParams encode Nothing f23 v23, toField backendParams encode Nothing f24 v24, toField backendParams encode Nothing f25 v25, toField backendParams encode Nothing f26 v26, toField backendParams encode Nothing f27 v27, toField backendParams encode Nothing f28 v28, toField backendParams encode Nothing f29 v29, toField backendParams encode Nothing f30 v30, toField backendParams encode Nothing f31 v31, toField backendParams encode Nothing f32 v32, toField backendParams encode Nothing f33 v33, toField backendParams encode Nothing f34 v34, toField backendParams encode Nothing f35 v35, toField backendParams encode Nothing f36 v36, toField backendParams encode Nothing f37 v37, toField backendParams encode Nothing f38 v38, toField backendParams encode Nothing f39 v39, toField backendParams encode Nothing f40 v40, toField backendParams encode Nothing f41 v41, toField backendParams encode Nothing f42 v42, toField backendParams encode Nothing f43 v43, toField backendParams encode Nothing f44 v44, toField backendParams encode Nothing f45 v45, toField backendParams encode Nothing f46 v46, toField backendParams encode Nothing f47 v47, toField backendParams encode Nothing f48 v48, toField backendParams encode Nothing f49 v49, toField backendParams encode Nothing f50 v50, toField backendParams encode Nothing f51 v51, toField backendParams encode Nothing f52 v52, toField backendParams encode Nothing f53 v53, toField backendParams encode Nothing f54 v54, toField backendParams encode Nothing f55 v55, toField backendParams encode Nothing f56 v56, toField backendParams encode Nothing f57 v57, toField backendParams encode Nothing f58 v58, toField backendParams encode Nothing f59 v59, toField backendParams encode Nothing f60 v60, toField backendParams encode Nothing f61 v61]+ toRecord backendParams encode (Just [o0, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16, o17, o18, o19, o20, o21, o22, o23, o24, o25, o26, o27, o28, o29, o30, o31, o32, o33, o34, o35, o36, o37, o38, o39, o40, o41, o42, o43, o44, o45, o46, o47, o48, o49, o50, o51, o52, o53, o54, o55, o56, o57, o58, o59, o60, o61]) [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58, f59, f60, f61] (v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61) =+ sequence [toField backendParams encode (Just o0) f0 v0, toField backendParams encode (Just o1) f1 v1, toField backendParams encode (Just o2) f2 v2, toField backendParams encode (Just o3) f3 v3, toField backendParams encode (Just o4) f4 v4, toField backendParams encode (Just o5) f5 v5, toField backendParams encode (Just o6) f6 v6, toField backendParams encode (Just o7) f7 v7, toField backendParams encode (Just o8) f8 v8, toField backendParams encode (Just o9) f9 v9, toField backendParams encode (Just o10) f10 v10, toField backendParams encode (Just o11) f11 v11, toField backendParams encode (Just o12) f12 v12, toField backendParams encode (Just o13) f13 v13, toField backendParams encode (Just o14) f14 v14, toField backendParams encode (Just o15) f15 v15, toField backendParams encode (Just o16) f16 v16, toField backendParams encode (Just o17) f17 v17, toField backendParams encode (Just o18) f18 v18, toField backendParams encode (Just o19) f19 v19, toField backendParams encode (Just o20) f20 v20, toField backendParams encode (Just o21) f21 v21, toField backendParams encode (Just o22) f22 v22, toField backendParams encode (Just o23) f23 v23, toField backendParams encode (Just o24) f24 v24, toField backendParams encode (Just o25) f25 v25, toField backendParams encode (Just o26) f26 v26, toField backendParams encode (Just o27) f27 v27, toField backendParams encode (Just o28) f28 v28, toField backendParams encode (Just o29) f29 v29, toField backendParams encode (Just o30) f30 v30, toField backendParams encode (Just o31) f31 v31, toField backendParams encode (Just o32) f32 v32, toField backendParams encode (Just o33) f33 v33, toField backendParams encode (Just o34) f34 v34, toField backendParams encode (Just o35) f35 v35, toField backendParams encode (Just o36) f36 v36, toField backendParams encode (Just o37) f37 v37, toField backendParams encode (Just o38) f38 v38, toField backendParams encode (Just o39) f39 v39, toField backendParams encode (Just o40) f40 v40, toField backendParams encode (Just o41) f41 v41, toField backendParams encode (Just o42) f42 v42, toField backendParams encode (Just o43) f43 v43, toField backendParams encode (Just o44) f44 v44, toField backendParams encode (Just o45) f45 v45, toField backendParams encode (Just o46) f46 v46, toField backendParams encode (Just o47) f47 v47, toField backendParams encode (Just o48) f48 v48, toField backendParams encode (Just o49) f49 v49, toField backendParams encode (Just o50) f50 v50, toField backendParams encode (Just o51) f51 v51, toField backendParams encode (Just o52) f52 v52, toField backendParams encode (Just o53) f53 v53, toField backendParams encode (Just o54) f54 v54, toField backendParams encode (Just o55) f55 v55, toField backendParams encode (Just o56) f56 v56, toField backendParams encode (Just o57) f57 v57, toField backendParams encode (Just o58) f58 v58, toField backendParams encode (Just o59) f59 v59, toField backendParams encode (Just o60) f60 v60, toField backendParams encode (Just o61) f61 v61]+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be 62, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 62, actually " <> show (length fs)++-- list+instance+ {-# OVERLAPPING #-}+ ToField a+ => ToRecord [a] where+ toRecord backendParams encode Nothing fs vs =+ sequence $ uncurry (toField backendParams encode Nothing) <$> zip fs vs+ toRecord backendParams encode (Just os) fs vs =+ assert (length os == length fs && length fs == length vs) $ sequence $ uncurry3 (toField backendParams encode) <$> zip3 (Just <$> os) fs vs++uncurry3 :: (a -> b -> c -> d) -> (a, b, c) -> d+uncurry3 f (a, b, c) = f a b c
src/Database/PostgreSQL/Pure/Internal/Connection.hs view
@@ -11,7 +11,7 @@ import qualified Database.PostgreSQL.Pure.Internal.Builder as Builder import Database.PostgreSQL.Pure.Internal.Data (Address (AddressNotResolved, AddressResolved), AuthenticationMD5Password (AuthenticationMD5Password),- AuthenticationResponse (AuthenticationMD5PasswordResponse, AuthenticationOkResponse),+ AuthenticationResponse (AuthenticationCleartextPasswordResponse, AuthenticationMD5PasswordResponse, AuthenticationOkResponse), BackendKey, BackendKeyData (BackendKeyData), BackendParameters, Buffer (Buffer), Config (Config, address, database, password, receptionBufferSize, sendingBufferSize, user),@@ -129,6 +129,7 @@ (_, _, _, Config { user, password }) <- ask case response of AuthenticationOkResponse -> pure ()+ AuthenticationCleartextPasswordResponse -> auth $ BSU.fromString password AuthenticationMD5PasswordResponse (AuthenticationMD5Password salt) -> auth $ hashMD5 user password salt (bps, pid, bk) <- receive $ do
src/Database/PostgreSQL/Pure/Internal/Data.hs view
@@ -50,6 +50,8 @@ , BackendKey , Oid (..) , Raw (Null, Value)+ , SqlIdentifier (..)+ , TimeOfDayWithTimeZone (..) , Query (..) , PreparedStatement (..) , PreparedStatementProcedure (..)@@ -67,7 +69,6 @@ , FromRecord (..) , ToField (..) , ToRecord (..)- , SqlIdentifier (..) , Pretty (..) ) where @@ -86,6 +87,7 @@ import Data.List (intercalate) import Data.Map.Strict (Map) import Data.String (IsString)+import Data.Time (TimeOfDay, TimeZone) import Data.Word (Word8) import Foreign (ForeignPtr) import Hexdump (prettyHex, simpleHex)@@ -231,6 +233,7 @@ data AuthenticationResponse = AuthenticationOkResponse+ | AuthenticationCleartextPasswordResponse | AuthenticationMD5PasswordResponse AuthenticationMD5Password deriving (Show, Read, Eq) @@ -465,6 +468,8 @@ -- | Type of PostgreSQL @sql_identifier@ type. newtype SqlIdentifier = SqlIdentifier BS.ByteString deriving (Show, Read, Eq) +data TimeOfDayWithTimeZone = TimeOfDayWithTimeZone { timeOfDay :: TimeOfDay, timeZone :: TimeZone } deriving (Show, Read, Eq, Ord)+ class Pretty a where pretty :: a -> String @@ -486,8 +491,9 @@ pretty (DebugResponse r) = pretty r instance Pretty AuthenticationResponse where- pretty AuthenticationOkResponse = "authentication ok"- pretty (AuthenticationMD5PasswordResponse r) = pretty r+ pretty AuthenticationOkResponse = "authentication ok"+ pretty AuthenticationCleartextPasswordResponse = "authentication using cleartext"+ pretty (AuthenticationMD5PasswordResponse r) = pretty r instance Pretty AuthenticationMD5Password where pretty (AuthenticationMD5Password salt) = "authentication MD5 password:\n\tsalt: " <> simpleHex salt
− src/Database/PostgreSQL/Pure/Internal/IsLabel.hs
@@ -1,14 +0,0 @@-{-# LANGUAGE FlexibleInstances #-}-{-# LANGUAGE MultiParamTypeClasses #-}-{-# LANGUAGE ScopedTypeVariables #-}-{-# LANGUAGE TypeApplications #-}--{-# OPTIONS_GHC -Wno-orphans #-}--module Database.PostgreSQL.Pure.Internal.IsLabel () where--import GHC.OverloadedLabels (IsLabel (fromLabel))-import GHC.Records (HasField (getField))--instance HasField x r a => IsLabel x (r -> a) where- fromLabel = getField @x
+ src/Database/PostgreSQL/Pure/Internal/Length.hs view
@@ -0,0 +1,261 @@+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE DefaultSignatures #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE UndecidableInstances #-}++module Database.PostgreSQL.Pure.Internal.Length+ (Length) where++import qualified Data.ByteString as BS+import Data.Functor.Identity (Identity)+import Data.Int (Int16, Int32, Int64)+import Data.Proxy (Proxy)+import Data.Scientific (Scientific)+import Data.Time (Day, DiffTime, LocalTime, TimeOfDay, UTCTime)+import Data.Tuple.OneTuple (OneTuple)+import Data.Tuple.Only (Only)+import Database.PostgreSQL.Pure.Internal.Data (Oid, Raw, SqlIdentifier, TimeOfDayWithTimeZone)+import GHC.TypeLits (Nat)++-- | The number of columns.+type family Length a :: Nat++type instance Length Bool = 1++type instance Length Int = 1++type instance Length Int16 = 1++type instance Length Int32 = 1++type instance Length Int64 = 1++type instance Length Scientific = 1++type instance Length Float = 1++type instance Length Double = 1++type instance Length Oid = 1++type instance Length Char = 1++type instance Length String = 1++type instance Length BS.ByteString = 1++type instance Length Day = 1++type instance Length TimeOfDay = 1++type instance Length TimeOfDayWithTimeZone = 1++type instance Length LocalTime = 1++type instance Length UTCTime = 1++type instance Length DiffTime = 1++type instance Length SqlIdentifier = 1++type instance Length Raw = 1++type instance Length (Maybe a) = 1++-- 0 tuple+type instance Length () = 0++type instance Length (Proxy a) = 0++-- 1 tuple+type instance Length (Identity a) = 1++type instance Length (OneTuple a) = 1++type instance Length (Only a) = 1++-- 2-tuple+type instance Length (i0, i1) = 2++-- 3-tuple+type instance Length (i0, i1, i2) = 3++-- 4-tuple+type instance Length (i0, i1, i2, i3) = 4++-- 5-tuple+type instance Length (i0, i1, i2, i3, i4) = 5++-- 6-tuple+type instance Length (i0, i1, i2, i3, i4, i5) = 6++-- 7-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6) = 7++-- 8-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7) = 8++-- 9-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8) = 9++-- 10-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9) = 10++-- 11-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10) = 11++-- 12-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11) = 12++-- 13-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12) = 13++-- 14-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13) = 14++-- 15-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14) = 15++-- 16-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15) = 16++-- 17-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16) = 17++-- 18-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17) = 18++-- 19-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18) = 19++-- 20-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19) = 20++-- 21-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20) = 21++-- 22-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21) = 22++-- 23-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22) = 23++-- 24-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23) = 24++-- 25-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24) = 25++-- 26-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25) = 26++-- 27-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26) = 27++-- 28-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27) = 28++-- 29-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28) = 29++-- 30-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29) = 30++-- 31-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30) = 31++-- 32-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31) = 32++-- 33-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32) = 33++-- 34-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33) = 34++-- 35-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34) = 35++-- 36-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35) = 36++-- 37-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36) = 37++-- 38-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37) = 38++-- 39-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38) = 39++-- 40-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39) = 40++-- 41-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40) = 41++-- 42-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41) = 42++-- 43-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42) = 43++-- 44-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43) = 44++-- 45-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44) = 45++-- 46-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45) = 46++-- 47-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46) = 47++-- 48-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47) = 48++-- 49-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48) = 49++-- 50-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49) = 50++-- 51-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50) = 51++-- 52-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51) = 52++-- 53-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52) = 53++-- 54-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52, i53) = 54++-- 55-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52, i53, i54) = 55++-- 56-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52, i53, i54, i55) = 56++-- 57-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52, i53, i54, i55, i56) = 57++-- 58-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52, i53, i54, i55, i56, i57) = 58++-- 59-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52, i53, i54, i55, i56, i57, i58) = 59++-- 60-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52, i53, i54, i55, i56, i57, i58, i59) = 60++-- 61-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52, i53, i54, i55, i56, i57, i58, i59, i60) = 61++-- 62-tuple+type instance Length (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52, i53, i54, i55, i56, i57, i58, i59, i60, i61) = 62
+ src/Database/PostgreSQL/Pure/Internal/Parser.hs view
@@ -0,0 +1,1079 @@+{-# LANGUAGE CPP #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE NamedFieldPuns #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE PatternSynonyms #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TypeApplications #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE TypeSynonymInstances #-}+{-# LANGUAGE UndecidableInstances #-}++{-# OPTIONS_GHC -Wno-missing-import-lists #-}-- for Prelude+{-# OPTIONS_GHC -Wno-orphans #-}++#include "MachDeps.h"++module Database.PostgreSQL.Pure.Internal.Parser+ ( response+ , authentication+ , authenticationOk+ , error+ , notice+ , parameterStatus+ , backendKeyData+ , readyForQuery+ , rowDescription+ , dataRow+ , dataRowRaw+ , commandComplete+ , parseComplete+ , bindComplete+ , portalSuspended+ , emptyQuery+ , closeComplete+ , noData+ , parameterDescription+ , skipUntilError+ , currentPos+ , column+ , attoparsecParser+ , valueParser+ ) where++import Database.PostgreSQL.Pure.Internal.Data (AuthenticationMD5Password (AuthenticationMD5Password), AuthenticationResponse (AuthenticationMD5PasswordResponse, AuthenticationOkResponse, AuthenticationCleartextPasswordResponse),+ BackendKeyData (BackendKeyData),+ ColumnInfo (ColumnInfo, typeOid),+ CommandComplete (CommandComplete),+ CommandTag (BeginTag, CommitTag, CopyTag, CreateTableTag, DeleteTag, DropTableTag, FetchTag, InsertTag, MoveTag, RollbackTag, SelectTag, SetTag, UpdateTag),+ DataRow (DataRow), DataRowRaw (DataRowRaw),+ Debug (Debug), Error (Error),+ ErrorFields (ErrorFields),+ FormatCode (BinaryFormat, TextFormat),+ FromField (fromField), FromRecord (fromRecord),+ Notice (Notice), Oid (Oid),+ ParameterDescription (ParameterDescription),+ ParameterStatus (ParameterStatus), Raw (Null, Value),+ ReadyForQuery (ReadyForQuery), Response (..),+ RowDescription (RowDescription),+ SqlIdentifier (SqlIdentifier), StringDecoder, TimeOfDayWithTimeZone (TimeOfDayWithTimeZone),+ TransactionState (Block, Failed, Idle),+ TypeLength (FixedLength, VariableLength))+import qualified Database.PostgreSQL.Pure.Internal.Data as Data+import qualified Database.PostgreSQL.Pure.Internal.MonadFail as MonadFail+import qualified Database.PostgreSQL.Pure.Oid as Oid+import qualified Database.PostgreSQL.Simple.Time.Internal.Parser as Time++import Prelude hiding (error, fail)++import Control.Exception (assert)+import Control.Monad (replicateM, unless, void)+import Control.Monad.Fail (MonadFail (fail))+import qualified Data.Attoparsec.ByteString as AP+import qualified Data.Attoparsec.ByteString.Char8 as APC+import Data.Attoparsec.Combinator ((<?>))+import qualified Data.Attoparsec.Combinator as AP+import qualified Data.Attoparsec.Internal.Types as API+import qualified Data.ByteString as BS+import qualified Data.ByteString.Internal as BSI+import qualified Data.ByteString.Short as BSS+import qualified Data.ByteString.UTF8 as BSU+import Data.Functor (($>))+import Data.Int (Int16, Int32, Int64, Int8)+import Data.Kind (Type)+import Data.Maybe (fromMaybe)+import Data.Memory.Endian (BE, ByteSwap, fromBE)+import Data.Scientific (Scientific, scientific)+import qualified Data.Text as Text+import Data.Time (Day, DiffTime, LocalTime, TimeOfDay,+ UTCTime, utc)+import Data.Tuple.Single (Single, pattern Single)+import Data.Word (Word16, Word32, Word64, Word8)+import Foreign (withForeignPtr)+import Foreign.Storable (Storable, peekByteOff, sizeOf)+import GHC.Stack (HasCallStack, callStack, prettyCallStack)+import qualified PostgreSQL.Binary.Decoding as BD+import System.IO.Unsafe (unsafeDupablePerformIO)++#if MIN_VERSION_base(4,13,0)+import Control.Applicative ((<|>))+#else+import Control.Applicative ((*>), (<|>))+#endif++response :: AP.Parser Response+response =+ AuthenticationResponse <$> authentication+ <|> ErrorResponse <$> error+ <|> NoticeResponse <$> notice+ <|> ParameterStatusResponse <$> parameterStatus+ <|> BackendKeyDataResponse <$> backendKeyData+ <|> ReadyForQueryResponse <$> readyForQuery+ <|> RowDescriptionResponse <$> rowDescription+ <|> DataRowResponse <$> dataRowRaw+ <|> CommandCompleteResponse <$> commandComplete+ <|> (parseComplete >> pure ParseCompleteResponse)+ <|> (bindComplete >> pure BindCompleteResponse)+ <|> (emptyQuery >> pure EmptyQueryResponse)+ <|> DebugResponse <$> debug++responseHeader :: AP.Parser Char -> AP.Parser (Char, Int)+responseHeader identParser =+ (<?> "response header") $ do+ ident <- identParser+ len32 <- anyInt32BE+ let len = fromIntegral len32 - 4 :: Int -- minus length of "length field"+ pure (ident, len)++authentication :: AP.Parser AuthenticationResponse+authentication =+ (<?> "authentication") $ do+ (_, len) <- responseHeader $ APC.char 'R'+ checkConsumed len $ do+ method <- anyInt32BE+ case method of+ 0 -> pure AuthenticationOkResponse+ 3 -> pure AuthenticationCleartextPasswordResponse+ 5 -> AuthenticationMD5PasswordResponse . AuthenticationMD5Password . BS.copy <$> AP.take 4+ t -> fail $ "not yet implemeted authentication type: " <> show t++authenticationOk :: AP.Parser ()+authenticationOk =+ (<?> "authentication ok") $ do+ (_, len) <- responseHeader $ APC.char 'R'+ checkConsumed len $ void $ int32BE 0++error :: AP.Parser Error+error =+ (<?> "error") $ do+ (_, len) <- responseHeader $ APC.char 'E'+ checkConsumed len $ Error . ErrorFields <$> list ((,) <$> APC.anyChar <*> (BSS.toShort <$> string))++notice :: AP.Parser Notice+notice =+ (<?> "notice") $ do+ (_, len) <- responseHeader $ APC.char 'N'+ checkConsumed len $ Notice . ErrorFields <$> list ((,) <$> APC.anyChar <*> (BSS.toShort <$> string))++parameterStatus :: AP.Parser ParameterStatus+parameterStatus =+ (<?> "parameter status") $ do+ (_, len) <- responseHeader $ APC.char 'S'+ checkConsumed len $ ParameterStatus <$> (BSS.toShort <$> string) <*> (BSS.toShort <$> string)++backendKeyData :: AP.Parser BackendKeyData+backendKeyData =+ (<?> "backend key data") $ do+ (_, len) <- responseHeader $ APC.char 'K'+ checkConsumed len $ BackendKeyData <$> anyInt32BE <*> anyInt32BE++readyForQuery :: AP.Parser ReadyForQuery+readyForQuery =+ (<?> "ready for query") $ do+ (_, len) <- responseHeader $ APC.char 'Z'+ checkConsumed len $ do+ t <- APC.anyChar+ case t of+ 'I' -> pure $ ReadyForQuery Idle+ 'T' -> pure $ ReadyForQuery Block+ 'E' -> pure $ ReadyForQuery Failed+ _ -> fail "invalid transacion state character"++rowDescription :: AP.Parser RowDescription+rowDescription =+ (<?> "row description") $ do+ (_, len) <- responseHeader $ APC.char 'T'+ checkConsumed len $ do+ fieldCount <- anyInt16BE+ RowDescription <$>+ replicateM+ (fromIntegral fieldCount)+ (ColumnInfo <$> string <*> oid <*> anyInt16BE <*> oid <*> typeLength <*> anyInt32BE <*> formatCode)++dataRow :: FromRecord r => StringDecoder -> [ColumnInfo] -> AP.Parser (DataRow r)+dataRow decode infos =+ (<?> "data row") $ do+ (_, len) <- responseHeader $ APC.char 'D'+ checkConsumed len $ do+ void $ int16BE (fromIntegral $ length infos)+ DataRow <$> fromRecord decode infos++dataRowRaw :: AP.Parser DataRowRaw+dataRowRaw =+ (<?> "data row raw") $ do+ (_, len) <- responseHeader $ APC.char 'D'+ checkConsumed len $ do+ columnCount <- anyInt16BE+ let+ go = do+ l <- anyInt32BE+ case l of+ (-1) -> pure Null+ _ -> Value . BS.copy <$> AP.take (fromIntegral l)+ DataRowRaw <$>+ replicateM+ (fromIntegral columnCount)+ go++commandComplete :: AP.Parser CommandComplete+commandComplete =+ (<?> "command complete") $ do+ (_, len) <- responseHeader $ APC.char 'C'+ checkConsumed len $+ do+ void $ APC.string "INSERT "+ o <- Oid <$> APC.decimal+ void $ APC.char ' '+ r <- APC.decimal+ void $ AP.word8 0+ pure $ CommandComplete $ InsertTag o r+ <|>+ do+ void $ APC.string "DELETE "+ r <- APC.decimal+ void $ AP.word8 0+ pure $ CommandComplete $ DeleteTag r+ <|>+ do+ void $ APC.string "UPDATE "+ r <- APC.decimal+ void $ AP.word8 0+ pure $ CommandComplete $ UpdateTag r+ <|>+ do+ void $ APC.string "SELECT "+ r <- APC.decimal+ void $ AP.word8 0+ pure $ CommandComplete $ SelectTag r+ <|>+ do+ void $ APC.string "MOVE "+ r <- APC.decimal+ void $ AP.word8 0+ pure $ CommandComplete $ MoveTag r+ <|>+ do+ void $ APC.string "FETCH "+ r <- APC.decimal+ void $ AP.word8 0+ pure $ CommandComplete $ FetchTag r+ <|>+ do+ void $ APC.string "COPY "+ r <- APC.decimal+ void $ AP.word8 0+ pure $ CommandComplete $ CopyTag r+ <|> APC.string "CREATE TABLE" *> AP.word8 0 $> CommandComplete CreateTableTag+ <|> APC.string "DROP TABLE" *> AP.word8 0 $> CommandComplete DropTableTag+ <|> APC.string "BEGIN" *> AP.word8 0 $> CommandComplete BeginTag+ <|> APC.string "COMMIT" *> AP.word8 0 $> CommandComplete CommitTag+ <|> APC.string "ROLLBACK" *> AP.word8 0 $> CommandComplete RollbackTag+ <|> APC.string "SET" *> AP.word8 0 $> CommandComplete SetTag++parseComplete :: AP.Parser ()+parseComplete =+ (<?> "parse complete") $ do+ void $ APC.char8 '1'+ void $ int32BE 4++bindComplete :: AP.Parser ()+bindComplete =+ (<?> "bind complete") $ do+ void $ APC.char8 '2'+ void $ int32BE 4++noData :: AP.Parser ()+noData =+ (<?> "no data") $ do+ void $ APC.char8 'n'+ void $ int32BE 4++parameterDescription :: AP.Parser ParameterDescription+parameterDescription =+ (<?> "parameter description") $ do+ (_, len) <- responseHeader $ APC.char 't'+ checkConsumed len $ do+ n <- anyInt16BE+ ParameterDescription <$> replicateM (fromIntegral n) oid++emptyQuery :: AP.Parser ()+emptyQuery =+ (<?> "empty query") $ do+ void $ APC.char8 'I'+ void $ int32BE 4++portalSuspended :: AP.Parser ()+portalSuspended =+ (<?> "portal suspended") $ do+ void $ APC.char8 's'+ void $ int32BE 4++closeComplete :: AP.Parser ()+closeComplete =+ (<?> "close complete") $ do+ void $ APC.char8 '3'+ void $ int32BE 4++skipUntilError :: AP.Parser Error+skipUntilError =+ (<?> "skip until error") $ do+ (ident, len) <- responseHeader APC.anyChar+ case ident of+ 'E' -> checkConsumed len $ Error . ErrorFields <$> list ((,) <$> APC.anyChar <*> (BSS.toShort <$> string))+ _ -> AP.take len >> skipUntilError++debug :: AP.Parser Debug+debug = do+ ident <- AP.anyWord8+ len <- AP.lookAhead anyInt32BE+ bs <- AP.take $ fromIntegral len+ pure $ Debug $ BS.cons ident bs++satisfyN :: Int -> (BS.ByteString -> a) -> (a -> Bool) -> AP.Parser a+satisfyN l f p = do+ bs <- AP.take l+ let a = f bs+ if p a+ then pure a+ else fail "satisfy n"++satisfyStorable :: forall a. Storable a => (BS.ByteString -> a) -> (a -> Bool) -> AP.Parser a+satisfyStorable f p = satisfyN (sizeOf (undefined :: a)) f p <?> "satisfy storable"++type family Unsigned a :: Type+type instance Unsigned Word8 = Word8+type instance Unsigned Word16 = Word16+type instance Unsigned Word32 = Word32+type instance Unsigned Word64 = Word64+type instance Unsigned Int8 = Word8+type instance Unsigned Int16 = Word16+type instance Unsigned Int32 = Word32+type instance Unsigned Int64 = Word64++satisfyIntegralBE :: forall a. (Integral a, Storable a, Integral (Unsigned a), ByteSwap (Unsigned a)) => (a -> Bool) -> AP.Parser a+satisfyIntegralBE p = satisfyStorable (fromIntegral . castByteSwapBE @(Unsigned a)) p <?> "satisfy integral big endian"++anyIntegralBE :: (Integral a, Storable a, Integral (Unsigned a), ByteSwap (Unsigned a)) => AP.Parser a+anyIntegralBE = satisfyIntegralBE (const True) <?> "any integral big endian"++anyInt16BE :: AP.Parser Int16+anyInt16BE = anyIntegralBE <?> "any int16 big endian"++anyInt32BE :: AP.Parser Int32+anyInt32BE = anyIntegralBE <?> "any int32 big endian"++integralBE :: (Integral a, Storable a, Integral (Unsigned a), ByteSwap (Unsigned a)) => a -> AP.Parser a+integralBE n = satisfyIntegralBE (== n) <?> "integral big endian"++int16BE :: Int16 -> AP.Parser Int16+int16BE n = integralBE n <?> "int16 big endian"++int32BE :: Int32 -> AP.Parser Int32+int32BE n = integralBE n <?> "int32 big endian"++castByteSwapBE :: forall a. ByteSwap a => BS.ByteString -> a+castByteSwapBE (BSI.PS fptr off len) =+ assert (sizeOf (undefined :: a) == len) $+ let+ be :: BE a+ be =+ unsafeDupablePerformIO $+ withForeignPtr fptr $ \ptr ->+ peekByteOff ptr off+ in fromBE be++string :: AP.Parser BS.ByteString+string = AP.takeWhile (/= 0) <* AP.word8 0 <?> "string"++list :: AP.Parser a -> AP.Parser [a]+list p = (AP.word8 0 >> pure []) <|> (:) <$> p <*> list p <?> "list"++typeLength :: AP.Parser TypeLength+typeLength =+ (<?> "type length") $ do+ len <- anyInt16BE+ if len < 0+ then pure VariableLength+ else pure $ FixedLength len++formatCode :: AP.Parser FormatCode+formatCode =+ (<?> "format code") $ do+ code <- anyInt16BE+ case code of+ 0 -> pure TextFormat+ 1 -> pure BinaryFormat+ _ -> fail "invalid format code"++oid :: AP.Parser Oid+oid = Oid <$> anyInt32BE <?> "OID"++checkConsumed :: HasCallStack => Int -> AP.Parser a -> AP.Parser a+checkConsumed expected parser = do+ API.Pos startPos <- currentPos+ r <- parser+ API.Pos endPos <- currentPos+ let consumed = endPos - startPos+ unless (expected == consumed) $+ fail $ "length mismatch: expected: " <> show expected <> ", consumed: " <> show consumed <> "\n" <> prettyCallStack callStack+ pure r++currentPos :: AP.Parser API.Pos+currentPos = API.Parser $ \t pos more _lose suc -> suc t pos more pos++instance FromField Bool where+ fromField _ ColumnInfo { typeOid, Data.formatCode } (Just v)+ | typeOid == Oid.bool+ = case formatCode of+ TextFormat | v == "t" -> pure True+ | v == "f" -> pure False+ | otherwise -> fail (show (BSU.toString v) <> " is not expected as bool")+ BinaryFormat -> valueParser BD.bool v+ fromField _ ColumnInfo { typeOid } _ = fail $ "type mismatch (FromField): OID: " <> show typeOid <> ", Haskell: Bool"++instance FromField Int where+ fromField _ ColumnInfo { typeOid, Data.formatCode } (Just v)+#if WORD_SIZE_IN_BITS < 32 /* the width of Int is wider than 30 bits */+ | typeOid == Oid.int2+#elif WORD_SIZE_IN_BITS < 64+ | typeOid `elem` [Oid.int2, Oid.int4]+#else+ | typeOid `elem` [Oid.int2, Oid.int4, Oid.int8]+#endif+ = case formatCode of+ TextFormat -> attoparsecParser (APC.signed APC.decimal) v+ BinaryFormat -> valueParser BD.int v+ fromField _ ColumnInfo { typeOid } _ = fail $ "type mismatch (FromField): OID: " <> show typeOid <> ", Haskell: Int"++instance FromField Int16 where+ fromField _ ColumnInfo { typeOid, Data.formatCode } (Just v)+ | typeOid == Oid.int2+ = case formatCode of+ TextFormat -> attoparsecParser (APC.signed APC.decimal) v+ BinaryFormat -> valueParser BD.int v+ fromField _ ColumnInfo { typeOid } _ = fail $ "type mismatch (FromField): OID: " <> show typeOid <> ", Haskell: Int16"++instance FromField Int32 where+ fromField _ ColumnInfo { typeOid, Data.formatCode } (Just v)+ | typeOid `elem` [Oid.int2, Oid.int4]+ = case formatCode of+ TextFormat -> attoparsecParser (APC.signed APC.decimal) v+ BinaryFormat -> valueParser BD.int v+ fromField _ ColumnInfo { typeOid } _ = fail $ "type mismatch (FromField): OID: " <> show typeOid <> ", Haskell: Int32"++instance FromField Int64 where+ fromField _ ColumnInfo { typeOid, Data.formatCode } (Just v)+ | typeOid `elem` [Oid.int2, Oid.int4, Oid.int8]+ = case formatCode of+ TextFormat -> attoparsecParser (APC.signed APC.decimal) v+ BinaryFormat -> valueParser BD.int v+ fromField _ ColumnInfo { typeOid } _ = fail $ "type mismatch (FromField): OID: " <> show typeOid <> ", Haskell: Int64"++instance FromField Scientific where+ fromField _ ColumnInfo { typeOid, Data.formatCode } (Just v)+ | typeOid `elem` [Oid.int2, Oid.int4, Oid.int8]+ = (flip scientific 0 <$>) $+ case formatCode of+ TextFormat -> attoparsecParser (APC.signed APC.decimal) v+ BinaryFormat -> valueParser BD.int v+ | typeOid == Oid.numeric+ = case formatCode of+ TextFormat -> attoparsecParser APC.scientific v+ BinaryFormat -> valueParser BD.numeric v+ fromField _ ColumnInfo { typeOid } _ = fail $ "type mismatch (FromField): OID: " <> show typeOid <> ", Haskell: Scientific"++instance FromField Float where+ fromField _ ColumnInfo { typeOid, Data.formatCode } (Just v)+ | typeOid == Oid.float4+ = case formatCode of+ TextFormat -> attoparsecParser APC.rational v+ BinaryFormat -> valueParser BD.float4 v+ fromField _ ColumnInfo { typeOid } _ = fail $ "type mismatch (FromField): OID: " <> show typeOid <> ", Haskell: Float"++instance FromField Double where+ fromField _ ColumnInfo { typeOid, Data.formatCode } (Just v)+ | typeOid == Oid.float4+ = case formatCode of+ TextFormat -> attoparsecParser APC.rational v+ BinaryFormat -> realToFrac <$> valueParser BD.float4 v+ | typeOid == Oid.float8+ = case formatCode of+ TextFormat -> attoparsecParser APC.double v+ BinaryFormat -> valueParser BD.float8 v+ fromField _ ColumnInfo { typeOid } _ = fail $ "type mismatch (FromField): OID: " <> show typeOid <> ", Haskell: Double"++instance FromField Oid where+ fromField _ ColumnInfo { typeOid, Data.formatCode } (Just v)+ | typeOid == Oid.oid+ = (Oid <$>) $+ case formatCode of+ TextFormat -> attoparsecParser APC.decimal v+ BinaryFormat -> valueParser BD.int v+ fromField _ ColumnInfo { typeOid } _ = fail $ "type mismatch (FromField): OID: " <> show typeOid <> ", Haskell: Oid"++instance FromField Char where+ fromField decode ColumnInfo { typeOid } (Just v)+ | typeOid == Oid.char+ = do+ str <- MonadFail.fromEither $ decode v+ case (str :: String) of+ [c] -> pure c+ _ -> fail $ "expected 1 character, actual " <> show (length str) <> " characters"+ fromField _ ColumnInfo { typeOid } _ = fail $ "type mismatch (FromField): OID: " <> show typeOid <> ", Haskell: Char"++instance FromField String where+ fromField decode ColumnInfo { typeOid } (Just v)+ | typeOid `elem` [Oid.text, Oid.bpchar, Oid.varchar, Oid.name]+ = MonadFail.fromEither $ decode v+ fromField _ ColumnInfo { typeOid } _ = fail $ "type mismatch (FromField): OID: " <> show typeOid <> ", Haskell: String"++instance FromField BS.ByteString where+ fromField _ ColumnInfo { typeOid } (Just v)+ | typeOid `elem` [Oid.text, Oid.bpchar, Oid.varchar, Oid.name, Oid.bytea] = pure v+ fromField _ ColumnInfo { typeOid } _ = fail $ "type mismatch (FromField): OID: " <> show typeOid <> ", Haskell: ByteString (strict)"++instance FromField Day where+ fromField _ ColumnInfo { typeOid, Data.formatCode } (Just v)+ | typeOid == Oid.date+ = case formatCode of+ TextFormat -> attoparsecParser Time.day v+ BinaryFormat -> valueParser BD.date v+ fromField _ ColumnInfo { typeOid } _ = fail $ "type mismatch (FromField): OID: " <> show typeOid <> ", Haskell: Day"++instance FromField TimeOfDay where+ fromField _ ColumnInfo { typeOid, Data.formatCode } (Just v)+ | typeOid == Oid.time+ = case formatCode of+ TextFormat -> attoparsecParser Time.timeOfDay v+ BinaryFormat -> valueParser BD.time_int v+ fromField _ ColumnInfo { typeOid } _ = fail $ "type mismatch (FromField): OID: " <> show typeOid <> ", Haskell: TimeOfDay"++instance FromField TimeOfDayWithTimeZone where+ fromField _ ColumnInfo { typeOid, Data.formatCode } (Just v)+ | typeOid == Oid.timetz+ = case formatCode of+ TextFormat -> attoparsecParser (TimeOfDayWithTimeZone <$> Time.timeOfDay <*> (fromMaybe utc <$> Time.timeZone)) v+ BinaryFormat -> valueParser BD.timetz_int v >>= \(t, tz) -> pure $ TimeOfDayWithTimeZone t tz+ fromField _ ColumnInfo { typeOid } _ = fail $ "type mismatch (FromField): OID: " <> show typeOid <> ", Haskell: TimeOfDayWithTimeZone"++instance FromField LocalTime where+ fromField _ ColumnInfo { typeOid, Data.formatCode } (Just v)+ | typeOid == Oid.timestamp+ = case formatCode of+ TextFormat -> attoparsecParser Time.localTime v+ BinaryFormat -> valueParser BD.timestamp_int v+ fromField _ ColumnInfo { typeOid } _ = fail $ "type mismatch (FromField): OID: " <> show typeOid <> ", Haskell: LocalTime"++instance FromField UTCTime where+ fromField _ ColumnInfo { typeOid, Data.formatCode } (Just v)+ | typeOid == Oid.timestamptz+ = case formatCode of+ TextFormat -> attoparsecParser Time.utcTime v+ BinaryFormat -> valueParser BD.timestamptz_int v+ fromField _ ColumnInfo { typeOid } _ = fail $ "type mismatch (FromField): OID: " <> show typeOid <> ", Haskell: UTCTime"++instance FromField DiffTime where+ fromField _ ColumnInfo { typeOid, Data.formatCode } (Just v)+ | typeOid == Oid.interval+ = case formatCode of+ TextFormat -> attoparsecParser Time.diffTime v+ BinaryFormat -> valueParser BD.interval_int v+ fromField _ ColumnInfo { typeOid } _ = fail $ "type mismatch (FromField): OID: " <> show typeOid <> ", Haskell: DiffTime"++instance FromField SqlIdentifier where+ fromField decode info@ColumnInfo { typeOid } v@(Just _)+ | typeOid == Oid.sqlIdentifier = SqlIdentifier <$> fromField decode info { typeOid = Oid.varchar } v -- pg_type.typbasetype+ fromField _ ColumnInfo { typeOid } _ = fail $ "type mismatch (FromField): OID: " <> show typeOid <> ", Haskell: SqlIdentifier"++instance FromField Raw where+ fromField _ _ (Just v) = pure $ Value v+ fromField _ _ Nothing = pure Null++instance FromField a => FromField (Maybe a) where+ fromField decode i v@(Just _) = Just <$> fromField decode i v+ fromField _ _ Nothing = pure Nothing++instance FromRecord Bool where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord Int where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord Int16 where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord Int32 where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord Int64 where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord Scientific where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord Float where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord Double where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord Oid where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord Char where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord String where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord BS.ByteString where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord Day where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord TimeOfDay where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord TimeOfDayWithTimeZone where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord LocalTime where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord UTCTime where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord DiffTime where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord SqlIdentifier where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord Raw where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromField a => FromRecord (Maybe a) where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++-- 0 tuple+instance FromRecord () where+ fromRecord _ [] = pure ()+ fromRecord _ is = fail $ "length mismatch: expected 0: actual: " <> show (length is)++-- 1 tuple+instance {-# OVERLAPPABLE #-} (FromField a, Single c, t ~ c a) => FromRecord t where+ fromRecord decode [i] = Single <$> column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++-- 2-tuple+instance (FromField i0, FromField i1) => FromRecord (i0, i1) where+ fromRecord decode [i0, i1] =+ (,) <$> column decode i0 <*> column decode i1+ fromRecord _ is = fail $ "length mismatch: expected 2: actual: " <> show (length is)++-- 3-tuple+instance (FromField i0, FromField i1, FromField i2) => FromRecord (i0, i1, i2) where+ fromRecord decode [i0, i1, i2] =+ (,,) <$> column decode i0 <*> column decode i1 <*> column decode i2+ fromRecord _ is = fail $ "length mismatch: expected 3: actual: " <> show (length is)++-- 4-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3) => FromRecord (i0, i1, i2, i3) where+ fromRecord decode [i0, i1, i2, i3] =+ (,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3+ fromRecord _ is = fail $ "length mismatch: expected 4: actual: " <> show (length is)++-- 5-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4) => FromRecord (i0, i1, i2, i3, i4) where+ fromRecord decode [i0, i1, i2, i3, i4] =+ (,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4+ fromRecord _ is = fail $ "length mismatch: expected 5: actual: " <> show (length is)++-- 6-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5) => FromRecord (i0, i1, i2, i3, i4, i5) where+ fromRecord decode [i0, i1, i2, i3, i4, i5] =+ (,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5+ fromRecord _ is = fail $ "length mismatch: expected 6: actual: " <> show (length is)++-- 7-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6) => FromRecord (i0, i1, i2, i3, i4, i5, i6) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6] =+ (,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6+ fromRecord _ is = fail $ "length mismatch: expected 7: actual: " <> show (length is)++-- 8-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7] =+ (,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7+ fromRecord _ is = fail $ "length mismatch: expected 8: actual: " <> show (length is)++-- 9-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8] =+ (,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8+ fromRecord _ is = fail $ "length mismatch: expected 9: actual: " <> show (length is)++-- 10-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9] =+ (,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9+ fromRecord _ is = fail $ "length mismatch: expected 10: actual: " <> show (length is)++-- 11-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10] =+ (,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10+ fromRecord _ is = fail $ "length mismatch: expected 11: actual: " <> show (length is)++-- 12-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11] =+ (,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11+ fromRecord _ is = fail $ "length mismatch: expected 12: actual: " <> show (length is)++-- 13-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12] =+ (,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12+ fromRecord _ is = fail $ "length mismatch: expected 13: actual: " <> show (length is)++-- 14-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13] =+ (,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13+ fromRecord _ is = fail $ "length mismatch: expected 14: actual: " <> show (length is)++-- 15-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14] =+ (,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14+ fromRecord _ is = fail $ "length mismatch: expected 15: actual: " <> show (length is)++-- 16-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15] =+ (,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15+ fromRecord _ is = fail $ "length mismatch: expected 16: actual: " <> show (length is)++-- 17-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16] =+ (,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16+ fromRecord _ is = fail $ "length mismatch: expected 17: actual: " <> show (length is)++-- 18-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17] =+ (,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17+ fromRecord _ is = fail $ "length mismatch: expected 18: actual: " <> show (length is)++-- 19-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18] =+ (,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18+ fromRecord _ is = fail $ "length mismatch: expected 19: actual: " <> show (length is)++-- 20-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19] =+ (,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19+ fromRecord _ is = fail $ "length mismatch: expected 20: actual: " <> show (length is)++-- 21-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20] =+ (,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20+ fromRecord _ is = fail $ "length mismatch: expected 21: actual: " <> show (length is)++-- 22-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21] =+ (,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21+ fromRecord _ is = fail $ "length mismatch: expected 22: actual: " <> show (length is)++-- 23-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22] =+ (,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22+ fromRecord _ is = fail $ "length mismatch: expected 23: actual: " <> show (length is)++-- 24-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23] =+ (,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23+ fromRecord _ is = fail $ "length mismatch: expected 24: actual: " <> show (length is)++-- 25-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24] =+ (,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24+ fromRecord _ is = fail $ "length mismatch: expected 25: actual: " <> show (length is)++-- 26-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25+ fromRecord _ is = fail $ "length mismatch: expected 26: actual: " <> show (length is)++-- 27-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25, FromField i26) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25 <*> column decode i26+ fromRecord _ is = fail $ "length mismatch: expected 27: actual: " <> show (length is)++-- 28-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25, FromField i26, FromField i27) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25 <*> column decode i26 <*> column decode i27+ fromRecord _ is = fail $ "length mismatch: expected 28: actual: " <> show (length is)++-- 29-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25, FromField i26, FromField i27, FromField i28) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25 <*> column decode i26 <*> column decode i27 <*> column decode i28+ fromRecord _ is = fail $ "length mismatch: expected 29: actual: " <> show (length is)++-- 30-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25, FromField i26, FromField i27, FromField i28, FromField i29) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25 <*> column decode i26 <*> column decode i27 <*> column decode i28 <*> column decode i29+ fromRecord _ is = fail $ "length mismatch: expected 30: actual: " <> show (length is)++-- 31-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25, FromField i26, FromField i27, FromField i28, FromField i29, FromField i30) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25 <*> column decode i26 <*> column decode i27 <*> column decode i28 <*> column decode i29 <*> column decode i30+ fromRecord _ is = fail $ "length mismatch: expected 31: actual: " <> show (length is)++-- 32-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25, FromField i26, FromField i27, FromField i28, FromField i29, FromField i30, FromField i31) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25 <*> column decode i26 <*> column decode i27 <*> column decode i28 <*> column decode i29 <*> column decode i30 <*> column decode i31+ fromRecord _ is = fail $ "length mismatch: expected 32: actual: " <> show (length is)++-- 33-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25, FromField i26, FromField i27, FromField i28, FromField i29, FromField i30, FromField i31, FromField i32) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25 <*> column decode i26 <*> column decode i27 <*> column decode i28 <*> column decode i29 <*> column decode i30 <*> column decode i31 <*> column decode i32+ fromRecord _ is = fail $ "length mismatch: expected 33: actual: " <> show (length is)++-- 34-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25, FromField i26, FromField i27, FromField i28, FromField i29, FromField i30, FromField i31, FromField i32, FromField i33) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25 <*> column decode i26 <*> column decode i27 <*> column decode i28 <*> column decode i29 <*> column decode i30 <*> column decode i31 <*> column decode i32 <*> column decode i33+ fromRecord _ is = fail $ "length mismatch: expected 34: actual: " <> show (length is)++-- 35-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25, FromField i26, FromField i27, FromField i28, FromField i29, FromField i30, FromField i31, FromField i32, FromField i33, FromField i34) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25 <*> column decode i26 <*> column decode i27 <*> column decode i28 <*> column decode i29 <*> column decode i30 <*> column decode i31 <*> column decode i32 <*> column decode i33 <*> column decode i34+ fromRecord _ is = fail $ "length mismatch: expected 35: actual: " <> show (length is)++-- 36-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25, FromField i26, FromField i27, FromField i28, FromField i29, FromField i30, FromField i31, FromField i32, FromField i33, FromField i34, FromField i35) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25 <*> column decode i26 <*> column decode i27 <*> column decode i28 <*> column decode i29 <*> column decode i30 <*> column decode i31 <*> column decode i32 <*> column decode i33 <*> column decode i34 <*> column decode i35+ fromRecord _ is = fail $ "length mismatch: expected 36: actual: " <> show (length is)++-- 37-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25, FromField i26, FromField i27, FromField i28, FromField i29, FromField i30, FromField i31, FromField i32, FromField i33, FromField i34, FromField i35, FromField i36) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25 <*> column decode i26 <*> column decode i27 <*> column decode i28 <*> column decode i29 <*> column decode i30 <*> column decode i31 <*> column decode i32 <*> column decode i33 <*> column decode i34 <*> column decode i35 <*> column decode i36+ fromRecord _ is = fail $ "length mismatch: expected 37: actual: " <> show (length is)++-- 38-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25, FromField i26, FromField i27, FromField i28, FromField i29, FromField i30, FromField i31, FromField i32, FromField i33, FromField i34, FromField i35, FromField i36, FromField i37) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25 <*> column decode i26 <*> column decode i27 <*> column decode i28 <*> column decode i29 <*> column decode i30 <*> column decode i31 <*> column decode i32 <*> column decode i33 <*> column decode i34 <*> column decode i35 <*> column decode i36 <*> column decode i37+ fromRecord _ is = fail $ "length mismatch: expected 38: actual: " <> show (length is)++-- 39-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25, FromField i26, FromField i27, FromField i28, FromField i29, FromField i30, FromField i31, FromField i32, FromField i33, FromField i34, FromField i35, FromField i36, FromField i37, FromField i38) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25 <*> column decode i26 <*> column decode i27 <*> column decode i28 <*> column decode i29 <*> column decode i30 <*> column decode i31 <*> column decode i32 <*> column decode i33 <*> column decode i34 <*> column decode i35 <*> column decode i36 <*> column decode i37 <*> column decode i38+ fromRecord _ is = fail $ "length mismatch: expected 39: actual: " <> show (length is)++-- 40-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25, FromField i26, FromField i27, FromField i28, FromField i29, FromField i30, FromField i31, FromField i32, FromField i33, FromField i34, FromField i35, FromField i36, FromField i37, FromField i38, FromField i39) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25 <*> column decode i26 <*> column decode i27 <*> column decode i28 <*> column decode i29 <*> column decode i30 <*> column decode i31 <*> column decode i32 <*> column decode i33 <*> column decode i34 <*> column decode i35 <*> column decode i36 <*> column decode i37 <*> column decode i38 <*> column decode i39+ fromRecord _ is = fail $ "length mismatch: expected 40: actual: " <> show (length is)++-- 41-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25, FromField i26, FromField i27, FromField i28, FromField i29, FromField i30, FromField i31, FromField i32, FromField i33, FromField i34, FromField i35, FromField i36, FromField i37, FromField i38, FromField i39, FromField i40) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25 <*> column decode i26 <*> column decode i27 <*> column decode i28 <*> column decode i29 <*> column decode i30 <*> column decode i31 <*> column decode i32 <*> column decode i33 <*> column decode i34 <*> column decode i35 <*> column decode i36 <*> column decode i37 <*> column decode i38 <*> column decode i39 <*> column decode i40+ fromRecord _ is = fail $ "length mismatch: expected 41: actual: " <> show (length is)++-- 42-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25, FromField i26, FromField i27, FromField i28, FromField i29, FromField i30, FromField i31, FromField i32, FromField i33, FromField i34, FromField i35, FromField i36, FromField i37, FromField i38, FromField i39, FromField i40, FromField i41) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25 <*> column decode i26 <*> column decode i27 <*> column decode i28 <*> column decode i29 <*> column decode i30 <*> column decode i31 <*> column decode i32 <*> column decode i33 <*> column decode i34 <*> column decode i35 <*> column decode i36 <*> column decode i37 <*> column decode i38 <*> column decode i39 <*> column decode i40 <*> column decode i41+ fromRecord _ is = fail $ "length mismatch: expected 42: actual: " <> show (length is)++-- 43-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25, FromField i26, FromField i27, FromField i28, FromField i29, FromField i30, FromField i31, FromField i32, FromField i33, FromField i34, FromField i35, FromField i36, FromField i37, FromField i38, FromField i39, FromField i40, FromField i41, FromField i42) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25 <*> column decode i26 <*> column decode i27 <*> column decode i28 <*> column decode i29 <*> column decode i30 <*> column decode i31 <*> column decode i32 <*> column decode i33 <*> column decode i34 <*> column decode i35 <*> column decode i36 <*> column decode i37 <*> column decode i38 <*> column decode i39 <*> column decode i40 <*> column decode i41 <*> column decode i42+ fromRecord _ is = fail $ "length mismatch: expected 43: actual: " <> show (length is)++-- 44-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25, FromField i26, FromField i27, FromField i28, FromField i29, FromField i30, FromField i31, FromField i32, FromField i33, FromField i34, FromField i35, FromField i36, FromField i37, FromField i38, FromField i39, FromField i40, FromField i41, FromField i42, FromField i43) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25 <*> column decode i26 <*> column decode i27 <*> column decode i28 <*> column decode i29 <*> column decode i30 <*> column decode i31 <*> column decode i32 <*> column decode i33 <*> column decode i34 <*> column decode i35 <*> column decode i36 <*> column decode i37 <*> column decode i38 <*> column decode i39 <*> column decode i40 <*> column decode i41 <*> column decode i42 <*> column decode i43+ fromRecord _ is = fail $ "length mismatch: expected 44: actual: " <> show (length is)++-- 45-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25, FromField i26, FromField i27, FromField i28, FromField i29, FromField i30, FromField i31, FromField i32, FromField i33, FromField i34, FromField i35, FromField i36, FromField i37, FromField i38, FromField i39, FromField i40, FromField i41, FromField i42, FromField i43, FromField i44) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25 <*> column decode i26 <*> column decode i27 <*> column decode i28 <*> column decode i29 <*> column decode i30 <*> column decode i31 <*> column decode i32 <*> column decode i33 <*> column decode i34 <*> column decode i35 <*> column decode i36 <*> column decode i37 <*> column decode i38 <*> column decode i39 <*> column decode i40 <*> column decode i41 <*> column decode i42 <*> column decode i43 <*> column decode i44+ fromRecord _ is = fail $ "length mismatch: expected 45: actual: " <> show (length is)++-- 46-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25, FromField i26, FromField i27, FromField i28, FromField i29, FromField i30, FromField i31, FromField i32, FromField i33, FromField i34, FromField i35, FromField i36, FromField i37, FromField i38, FromField i39, FromField i40, FromField i41, FromField i42, FromField i43, FromField i44, FromField i45) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25 <*> column decode i26 <*> column decode i27 <*> column decode i28 <*> column decode i29 <*> column decode i30 <*> column decode i31 <*> column decode i32 <*> column decode i33 <*> column decode i34 <*> column decode i35 <*> column decode i36 <*> column decode i37 <*> column decode i38 <*> column decode i39 <*> column decode i40 <*> column decode i41 <*> column decode i42 <*> column decode i43 <*> column decode i44 <*> column decode i45+ fromRecord _ is = fail $ "length mismatch: expected 46: actual: " <> show (length is)++-- 47-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25, FromField i26, FromField i27, FromField i28, FromField i29, FromField i30, FromField i31, FromField i32, FromField i33, FromField i34, FromField i35, FromField i36, FromField i37, FromField i38, FromField i39, FromField i40, FromField i41, FromField i42, FromField i43, FromField i44, FromField i45, FromField i46) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25 <*> column decode i26 <*> column decode i27 <*> column decode i28 <*> column decode i29 <*> column decode i30 <*> column decode i31 <*> column decode i32 <*> column decode i33 <*> column decode i34 <*> column decode i35 <*> column decode i36 <*> column decode i37 <*> column decode i38 <*> column decode i39 <*> column decode i40 <*> column decode i41 <*> column decode i42 <*> column decode i43 <*> column decode i44 <*> column decode i45 <*> column decode i46+ fromRecord _ is = fail $ "length mismatch: expected 47: actual: " <> show (length is)++-- 48-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25, FromField i26, FromField i27, FromField i28, FromField i29, FromField i30, FromField i31, FromField i32, FromField i33, FromField i34, FromField i35, FromField i36, FromField i37, FromField i38, FromField i39, FromField i40, FromField i41, FromField i42, FromField i43, FromField i44, FromField i45, FromField i46, FromField i47) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25 <*> column decode i26 <*> column decode i27 <*> column decode i28 <*> column decode i29 <*> column decode i30 <*> column decode i31 <*> column decode i32 <*> column decode i33 <*> column decode i34 <*> column decode i35 <*> column decode i36 <*> column decode i37 <*> column decode i38 <*> column decode i39 <*> column decode i40 <*> column decode i41 <*> column decode i42 <*> column decode i43 <*> column decode i44 <*> column decode i45 <*> column decode i46 <*> column decode i47+ fromRecord _ is = fail $ "length mismatch: expected 48: actual: " <> show (length is)++-- 49-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25, FromField i26, FromField i27, FromField i28, FromField i29, FromField i30, FromField i31, FromField i32, FromField i33, FromField i34, FromField i35, FromField i36, FromField i37, FromField i38, FromField i39, FromField i40, FromField i41, FromField i42, FromField i43, FromField i44, FromField i45, FromField i46, FromField i47, FromField i48) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25 <*> column decode i26 <*> column decode i27 <*> column decode i28 <*> column decode i29 <*> column decode i30 <*> column decode i31 <*> column decode i32 <*> column decode i33 <*> column decode i34 <*> column decode i35 <*> column decode i36 <*> column decode i37 <*> column decode i38 <*> column decode i39 <*> column decode i40 <*> column decode i41 <*> column decode i42 <*> column decode i43 <*> column decode i44 <*> column decode i45 <*> column decode i46 <*> column decode i47 <*> column decode i48+ fromRecord _ is = fail $ "length mismatch: expected 49: actual: " <> show (length is)++-- 50-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25, FromField i26, FromField i27, FromField i28, FromField i29, FromField i30, FromField i31, FromField i32, FromField i33, FromField i34, FromField i35, FromField i36, FromField i37, FromField i38, FromField i39, FromField i40, FromField i41, FromField i42, FromField i43, FromField i44, FromField i45, FromField i46, FromField i47, FromField i48, FromField i49) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25 <*> column decode i26 <*> column decode i27 <*> column decode i28 <*> column decode i29 <*> column decode i30 <*> column decode i31 <*> column decode i32 <*> column decode i33 <*> column decode i34 <*> column decode i35 <*> column decode i36 <*> column decode i37 <*> column decode i38 <*> column decode i39 <*> column decode i40 <*> column decode i41 <*> column decode i42 <*> column decode i43 <*> column decode i44 <*> column decode i45 <*> column decode i46 <*> column decode i47 <*> column decode i48 <*> column decode i49+ fromRecord _ is = fail $ "length mismatch: expected 50: actual: " <> show (length is)++-- 51-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25, FromField i26, FromField i27, FromField i28, FromField i29, FromField i30, FromField i31, FromField i32, FromField i33, FromField i34, FromField i35, FromField i36, FromField i37, FromField i38, FromField i39, FromField i40, FromField i41, FromField i42, FromField i43, FromField i44, FromField i45, FromField i46, FromField i47, FromField i48, FromField i49, FromField i50) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25 <*> column decode i26 <*> column decode i27 <*> column decode i28 <*> column decode i29 <*> column decode i30 <*> column decode i31 <*> column decode i32 <*> column decode i33 <*> column decode i34 <*> column decode i35 <*> column decode i36 <*> column decode i37 <*> column decode i38 <*> column decode i39 <*> column decode i40 <*> column decode i41 <*> column decode i42 <*> column decode i43 <*> column decode i44 <*> column decode i45 <*> column decode i46 <*> column decode i47 <*> column decode i48 <*> column decode i49 <*> column decode i50+ fromRecord _ is = fail $ "length mismatch: expected 51: actual: " <> show (length is)++-- 52-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25, FromField i26, FromField i27, FromField i28, FromField i29, FromField i30, FromField i31, FromField i32, FromField i33, FromField i34, FromField i35, FromField i36, FromField i37, FromField i38, FromField i39, FromField i40, FromField i41, FromField i42, FromField i43, FromField i44, FromField i45, FromField i46, FromField i47, FromField i48, FromField i49, FromField i50, FromField i51) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25 <*> column decode i26 <*> column decode i27 <*> column decode i28 <*> column decode i29 <*> column decode i30 <*> column decode i31 <*> column decode i32 <*> column decode i33 <*> column decode i34 <*> column decode i35 <*> column decode i36 <*> column decode i37 <*> column decode i38 <*> column decode i39 <*> column decode i40 <*> column decode i41 <*> column decode i42 <*> column decode i43 <*> column decode i44 <*> column decode i45 <*> column decode i46 <*> column decode i47 <*> column decode i48 <*> column decode i49 <*> column decode i50 <*> column decode i51+ fromRecord _ is = fail $ "length mismatch: expected 52: actual: " <> show (length is)++-- 53-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25, FromField i26, FromField i27, FromField i28, FromField i29, FromField i30, FromField i31, FromField i32, FromField i33, FromField i34, FromField i35, FromField i36, FromField i37, FromField i38, FromField i39, FromField i40, FromField i41, FromField i42, FromField i43, FromField i44, FromField i45, FromField i46, FromField i47, FromField i48, FromField i49, FromField i50, FromField i51, FromField i52) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25 <*> column decode i26 <*> column decode i27 <*> column decode i28 <*> column decode i29 <*> column decode i30 <*> column decode i31 <*> column decode i32 <*> column decode i33 <*> column decode i34 <*> column decode i35 <*> column decode i36 <*> column decode i37 <*> column decode i38 <*> column decode i39 <*> column decode i40 <*> column decode i41 <*> column decode i42 <*> column decode i43 <*> column decode i44 <*> column decode i45 <*> column decode i46 <*> column decode i47 <*> column decode i48 <*> column decode i49 <*> column decode i50 <*> column decode i51 <*> column decode i52+ fromRecord _ is = fail $ "length mismatch: expected 53: actual: " <> show (length is)++-- 54-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25, FromField i26, FromField i27, FromField i28, FromField i29, FromField i30, FromField i31, FromField i32, FromField i33, FromField i34, FromField i35, FromField i36, FromField i37, FromField i38, FromField i39, FromField i40, FromField i41, FromField i42, FromField i43, FromField i44, FromField i45, FromField i46, FromField i47, FromField i48, FromField i49, FromField i50, FromField i51, FromField i52, FromField i53) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52, i53) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52, i53] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25 <*> column decode i26 <*> column decode i27 <*> column decode i28 <*> column decode i29 <*> column decode i30 <*> column decode i31 <*> column decode i32 <*> column decode i33 <*> column decode i34 <*> column decode i35 <*> column decode i36 <*> column decode i37 <*> column decode i38 <*> column decode i39 <*> column decode i40 <*> column decode i41 <*> column decode i42 <*> column decode i43 <*> column decode i44 <*> column decode i45 <*> column decode i46 <*> column decode i47 <*> column decode i48 <*> column decode i49 <*> column decode i50 <*> column decode i51 <*> column decode i52 <*> column decode i53+ fromRecord _ is = fail $ "length mismatch: expected 54: actual: " <> show (length is)++-- 55-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25, FromField i26, FromField i27, FromField i28, FromField i29, FromField i30, FromField i31, FromField i32, FromField i33, FromField i34, FromField i35, FromField i36, FromField i37, FromField i38, FromField i39, FromField i40, FromField i41, FromField i42, FromField i43, FromField i44, FromField i45, FromField i46, FromField i47, FromField i48, FromField i49, FromField i50, FromField i51, FromField i52, FromField i53, FromField i54) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52, i53, i54) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52, i53, i54] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25 <*> column decode i26 <*> column decode i27 <*> column decode i28 <*> column decode i29 <*> column decode i30 <*> column decode i31 <*> column decode i32 <*> column decode i33 <*> column decode i34 <*> column decode i35 <*> column decode i36 <*> column decode i37 <*> column decode i38 <*> column decode i39 <*> column decode i40 <*> column decode i41 <*> column decode i42 <*> column decode i43 <*> column decode i44 <*> column decode i45 <*> column decode i46 <*> column decode i47 <*> column decode i48 <*> column decode i49 <*> column decode i50 <*> column decode i51 <*> column decode i52 <*> column decode i53 <*> column decode i54+ fromRecord _ is = fail $ "length mismatch: expected 55: actual: " <> show (length is)++-- 56-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25, FromField i26, FromField i27, FromField i28, FromField i29, FromField i30, FromField i31, FromField i32, FromField i33, FromField i34, FromField i35, FromField i36, FromField i37, FromField i38, FromField i39, FromField i40, FromField i41, FromField i42, FromField i43, FromField i44, FromField i45, FromField i46, FromField i47, FromField i48, FromField i49, FromField i50, FromField i51, FromField i52, FromField i53, FromField i54, FromField i55) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52, i53, i54, i55) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52, i53, i54, i55] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25 <*> column decode i26 <*> column decode i27 <*> column decode i28 <*> column decode i29 <*> column decode i30 <*> column decode i31 <*> column decode i32 <*> column decode i33 <*> column decode i34 <*> column decode i35 <*> column decode i36 <*> column decode i37 <*> column decode i38 <*> column decode i39 <*> column decode i40 <*> column decode i41 <*> column decode i42 <*> column decode i43 <*> column decode i44 <*> column decode i45 <*> column decode i46 <*> column decode i47 <*> column decode i48 <*> column decode i49 <*> column decode i50 <*> column decode i51 <*> column decode i52 <*> column decode i53 <*> column decode i54 <*> column decode i55+ fromRecord _ is = fail $ "length mismatch: expected 56: actual: " <> show (length is)++-- 57-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25, FromField i26, FromField i27, FromField i28, FromField i29, FromField i30, FromField i31, FromField i32, FromField i33, FromField i34, FromField i35, FromField i36, FromField i37, FromField i38, FromField i39, FromField i40, FromField i41, FromField i42, FromField i43, FromField i44, FromField i45, FromField i46, FromField i47, FromField i48, FromField i49, FromField i50, FromField i51, FromField i52, FromField i53, FromField i54, FromField i55, FromField i56) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52, i53, i54, i55, i56) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52, i53, i54, i55, i56] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25 <*> column decode i26 <*> column decode i27 <*> column decode i28 <*> column decode i29 <*> column decode i30 <*> column decode i31 <*> column decode i32 <*> column decode i33 <*> column decode i34 <*> column decode i35 <*> column decode i36 <*> column decode i37 <*> column decode i38 <*> column decode i39 <*> column decode i40 <*> column decode i41 <*> column decode i42 <*> column decode i43 <*> column decode i44 <*> column decode i45 <*> column decode i46 <*> column decode i47 <*> column decode i48 <*> column decode i49 <*> column decode i50 <*> column decode i51 <*> column decode i52 <*> column decode i53 <*> column decode i54 <*> column decode i55 <*> column decode i56+ fromRecord _ is = fail $ "length mismatch: expected 57: actual: " <> show (length is)++-- 58-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25, FromField i26, FromField i27, FromField i28, FromField i29, FromField i30, FromField i31, FromField i32, FromField i33, FromField i34, FromField i35, FromField i36, FromField i37, FromField i38, FromField i39, FromField i40, FromField i41, FromField i42, FromField i43, FromField i44, FromField i45, FromField i46, FromField i47, FromField i48, FromField i49, FromField i50, FromField i51, FromField i52, FromField i53, FromField i54, FromField i55, FromField i56, FromField i57) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52, i53, i54, i55, i56, i57) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52, i53, i54, i55, i56, i57] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25 <*> column decode i26 <*> column decode i27 <*> column decode i28 <*> column decode i29 <*> column decode i30 <*> column decode i31 <*> column decode i32 <*> column decode i33 <*> column decode i34 <*> column decode i35 <*> column decode i36 <*> column decode i37 <*> column decode i38 <*> column decode i39 <*> column decode i40 <*> column decode i41 <*> column decode i42 <*> column decode i43 <*> column decode i44 <*> column decode i45 <*> column decode i46 <*> column decode i47 <*> column decode i48 <*> column decode i49 <*> column decode i50 <*> column decode i51 <*> column decode i52 <*> column decode i53 <*> column decode i54 <*> column decode i55 <*> column decode i56 <*> column decode i57+ fromRecord _ is = fail $ "length mismatch: expected 58: actual: " <> show (length is)++-- 59-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25, FromField i26, FromField i27, FromField i28, FromField i29, FromField i30, FromField i31, FromField i32, FromField i33, FromField i34, FromField i35, FromField i36, FromField i37, FromField i38, FromField i39, FromField i40, FromField i41, FromField i42, FromField i43, FromField i44, FromField i45, FromField i46, FromField i47, FromField i48, FromField i49, FromField i50, FromField i51, FromField i52, FromField i53, FromField i54, FromField i55, FromField i56, FromField i57, FromField i58) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52, i53, i54, i55, i56, i57, i58) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52, i53, i54, i55, i56, i57, i58] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25 <*> column decode i26 <*> column decode i27 <*> column decode i28 <*> column decode i29 <*> column decode i30 <*> column decode i31 <*> column decode i32 <*> column decode i33 <*> column decode i34 <*> column decode i35 <*> column decode i36 <*> column decode i37 <*> column decode i38 <*> column decode i39 <*> column decode i40 <*> column decode i41 <*> column decode i42 <*> column decode i43 <*> column decode i44 <*> column decode i45 <*> column decode i46 <*> column decode i47 <*> column decode i48 <*> column decode i49 <*> column decode i50 <*> column decode i51 <*> column decode i52 <*> column decode i53 <*> column decode i54 <*> column decode i55 <*> column decode i56 <*> column decode i57 <*> column decode i58+ fromRecord _ is = fail $ "length mismatch: expected 59: actual: " <> show (length is)++-- 60-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25, FromField i26, FromField i27, FromField i28, FromField i29, FromField i30, FromField i31, FromField i32, FromField i33, FromField i34, FromField i35, FromField i36, FromField i37, FromField i38, FromField i39, FromField i40, FromField i41, FromField i42, FromField i43, FromField i44, FromField i45, FromField i46, FromField i47, FromField i48, FromField i49, FromField i50, FromField i51, FromField i52, FromField i53, FromField i54, FromField i55, FromField i56, FromField i57, FromField i58, FromField i59) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52, i53, i54, i55, i56, i57, i58, i59) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52, i53, i54, i55, i56, i57, i58, i59] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25 <*> column decode i26 <*> column decode i27 <*> column decode i28 <*> column decode i29 <*> column decode i30 <*> column decode i31 <*> column decode i32 <*> column decode i33 <*> column decode i34 <*> column decode i35 <*> column decode i36 <*> column decode i37 <*> column decode i38 <*> column decode i39 <*> column decode i40 <*> column decode i41 <*> column decode i42 <*> column decode i43 <*> column decode i44 <*> column decode i45 <*> column decode i46 <*> column decode i47 <*> column decode i48 <*> column decode i49 <*> column decode i50 <*> column decode i51 <*> column decode i52 <*> column decode i53 <*> column decode i54 <*> column decode i55 <*> column decode i56 <*> column decode i57 <*> column decode i58 <*> column decode i59+ fromRecord _ is = fail $ "length mismatch: expected 60: actual: " <> show (length is)++-- 61-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25, FromField i26, FromField i27, FromField i28, FromField i29, FromField i30, FromField i31, FromField i32, FromField i33, FromField i34, FromField i35, FromField i36, FromField i37, FromField i38, FromField i39, FromField i40, FromField i41, FromField i42, FromField i43, FromField i44, FromField i45, FromField i46, FromField i47, FromField i48, FromField i49, FromField i50, FromField i51, FromField i52, FromField i53, FromField i54, FromField i55, FromField i56, FromField i57, FromField i58, FromField i59, FromField i60) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52, i53, i54, i55, i56, i57, i58, i59, i60) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52, i53, i54, i55, i56, i57, i58, i59, i60] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25 <*> column decode i26 <*> column decode i27 <*> column decode i28 <*> column decode i29 <*> column decode i30 <*> column decode i31 <*> column decode i32 <*> column decode i33 <*> column decode i34 <*> column decode i35 <*> column decode i36 <*> column decode i37 <*> column decode i38 <*> column decode i39 <*> column decode i40 <*> column decode i41 <*> column decode i42 <*> column decode i43 <*> column decode i44 <*> column decode i45 <*> column decode i46 <*> column decode i47 <*> column decode i48 <*> column decode i49 <*> column decode i50 <*> column decode i51 <*> column decode i52 <*> column decode i53 <*> column decode i54 <*> column decode i55 <*> column decode i56 <*> column decode i57 <*> column decode i58 <*> column decode i59 <*> column decode i60+ fromRecord _ is = fail $ "length mismatch: expected 61: actual: " <> show (length is)++-- 62-tuple+instance (FromField i0, FromField i1, FromField i2, FromField i3, FromField i4, FromField i5, FromField i6, FromField i7, FromField i8, FromField i9, FromField i10, FromField i11, FromField i12, FromField i13, FromField i14, FromField i15, FromField i16, FromField i17, FromField i18, FromField i19, FromField i20, FromField i21, FromField i22, FromField i23, FromField i24, FromField i25, FromField i26, FromField i27, FromField i28, FromField i29, FromField i30, FromField i31, FromField i32, FromField i33, FromField i34, FromField i35, FromField i36, FromField i37, FromField i38, FromField i39, FromField i40, FromField i41, FromField i42, FromField i43, FromField i44, FromField i45, FromField i46, FromField i47, FromField i48, FromField i49, FromField i50, FromField i51, FromField i52, FromField i53, FromField i54, FromField i55, FromField i56, FromField i57, FromField i58, FromField i59, FromField i60, FromField i61) => FromRecord (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52, i53, i54, i55, i56, i57, i58, i59, i60, i61) where+ fromRecord decode [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47, i48, i49, i50, i51, i52, i53, i54, i55, i56, i57, i58, i59, i60, i61] =+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) <$> column decode i0 <*> column decode i1 <*> column decode i2 <*> column decode i3 <*> column decode i4 <*> column decode i5 <*> column decode i6 <*> column decode i7 <*> column decode i8 <*> column decode i9 <*> column decode i10 <*> column decode i11 <*> column decode i12 <*> column decode i13 <*> column decode i14 <*> column decode i15 <*> column decode i16 <*> column decode i17 <*> column decode i18 <*> column decode i19 <*> column decode i20 <*> column decode i21 <*> column decode i22 <*> column decode i23 <*> column decode i24 <*> column decode i25 <*> column decode i26 <*> column decode i27 <*> column decode i28 <*> column decode i29 <*> column decode i30 <*> column decode i31 <*> column decode i32 <*> column decode i33 <*> column decode i34 <*> column decode i35 <*> column decode i36 <*> column decode i37 <*> column decode i38 <*> column decode i39 <*> column decode i40 <*> column decode i41 <*> column decode i42 <*> column decode i43 <*> column decode i44 <*> column decode i45 <*> column decode i46 <*> column decode i47 <*> column decode i48 <*> column decode i49 <*> column decode i50 <*> column decode i51 <*> column decode i52 <*> column decode i53 <*> column decode i54 <*> column decode i55 <*> column decode i56 <*> column decode i57 <*> column decode i58 <*> column decode i59 <*> column decode i60 <*> column decode i61+ fromRecord _ is = fail $ "length mismatch: expected 62: actual: " <> show (length is)++-- list+instance {-# OVERLAPPABLE #-} FromField a => FromRecord [a] where+ fromRecord decode is = sequence $ column decode <$> is++-- | For implementing 'fromRecord'.+column :: FromField a => StringDecoder -> ColumnInfo -> AP.Parser a+column decode info = do+ l <- anyInt32BE+ case l of+ (-1) -> fromField decode info Nothing+ _ -> fromField decode info . Just =<< AP.take (fromIntegral l)++attoparsecParser :: MonadFail m => AP.Parser a -> BS.ByteString -> m a+attoparsecParser parser string =+ case AP.parseOnly (parser <* AP.endOfInput) string of+ Right a -> pure a+ Left e -> fail e++valueParser :: MonadFail m => BD.Value a -> BS.ByteString -> m a+valueParser parser string =+ case BD.valueParser parser string of+ Right a -> pure a+ Left e -> fail $ Text.unpack e
src/Database/PostgreSQL/Pure/Internal/Query.hs view
@@ -8,6 +8,7 @@ {-# LANGUAGE OverloadedLabels #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TypeApplications #-} {-# LANGUAGE TypeFamilies #-} module Database.PostgreSQL.Pure.Internal.Query@@ -51,7 +52,6 @@ TypeLength (FixedLength)) import qualified Database.PostgreSQL.Pure.Internal.Data as Data import qualified Database.PostgreSQL.Pure.Internal.Exception as Exception-import Database.PostgreSQL.Pure.Internal.IsLabel () import qualified Database.PostgreSQL.Pure.Internal.Parser as Parser import Database.PostgreSQL.Pure.Internal.SocketIO (buildAndSend, receive, runSocketIO, send) @@ -65,7 +65,7 @@ import qualified Data.ByteString.Char8 as BSC import Data.Functor (($>)) import Data.List (genericLength)-import GHC.OverloadedLabels (IsLabel)+import GHC.Records (HasField (getField)) #if !MIN_VERSION_base(4,13,0) import Control.Monad.Fail (MonadFail)@@ -195,20 +195,20 @@ close :: p -> CloseProcedure instance Close PreparedStatement where- close p = CloseProcedure (Builder.closePreparedStatement $ #name p) Parser.closeComplete+ close p = CloseProcedure (Builder.closePreparedStatement $ getField @"name" p) Parser.closeComplete instance Close Portal where- close p = CloseProcedure (Builder.closePortal $ #name p) Parser.closeComplete+ close p = CloseProcedure (Builder.closePortal $ getField @"name" p) Parser.closeComplete -- | This means that @r@ is a objective of 'flush' and 'sync'. class Message m where builder :: m -> BSB.Builder- default builder :: IsLabel "builder" (m -> BSB.Builder) => m -> BSB.Builder- builder = #builder+ default builder :: HasField "builder" m BSB.Builder => m -> BSB.Builder+ builder = getField @"builder" parser :: m -> AP.Parser (MessageResult m)- default parser :: IsLabel "parser" (m -> AP.Parser (MessageResult m)) => m -> AP.Parser (MessageResult m)- parser = #parser+ default parser :: HasField "parser" m (AP.Parser (MessageResult m)) => m -> AP.Parser (MessageResult m)+ parser = getField @"parser" instance Message PreparedStatementProcedure
src/Database/PostgreSQL/Pure/Internal/SocketIO.hs view
@@ -105,7 +105,7 @@ Left e@(Exception.InternalResponseParsingFailed _ raw) -> case AP.parse Parser.skipUntilError raw of AP.Done rest (Error fields) -> throw $ Exception.InternalErrorResponse fields Nothing rest- AP.Fail _ _ _ -> throw e+ AP.Fail {} -> throw e AP.Partial _ -> throw e Left e -> throw e
src/Database/PostgreSQL/Pure/List.hs view
@@ -32,8 +32,18 @@ -- >>> import Data.Int (Int32) -- >>> import Data.ByteString (ByteString) -- >>> import Data.Tuple.Only (Only (Only))+-- >>> import Data.Maybe (fromMaybe)+-- >>> import System.Environment (lookupEnv) -- >>>--- >>> conn <- connect def+-- >>> getEnvDef name value = fromMaybe value <$> lookupEnv name+-- >>>+-- >>> host' <- getEnvDef "PURE_HOST" "127.0.0.1"+-- >>> port' <- getEnvDef "PURE_PORT" "5432"+-- >>> user' <- getEnvDef "PURE_USER" "postgres"+-- >>> password' <- getEnvDef "PURE_PASSWORD" ""+-- >>> database' <- getEnvDef "PURE_DATABASE" "postgres"+-- >>>+-- >>> conn <- connect def { address = AddressNotResolved host' port', user = user', password = password', database = database' } -- >>> preparedStatementProcedure = parse "" "SELECT id, name FROM person WHERE id = $1" (Left (1, 2)) -- >>> portalProcedure <- bind "" BinaryFormat BinaryFormat (parameters conn) (const $ fail "") (Only (1 :: Int32)) preparedStatementProcedure -- >>> executedProcedure = execute @_ @(Int32, ByteString) 0 (const $ fail "") portalProcedure@@ -118,6 +128,5 @@ TransactionState (Block, Failed, Idle)) import qualified Database.PostgreSQL.Pure.Internal.Data as Data import qualified Database.PostgreSQL.Pure.Internal.Exception as Exception-import Database.PostgreSQL.Pure.Internal.IsLabel () import Database.PostgreSQL.Pure.Internal.Query (Bind (bind), Close (close), Execute (execute), Message, begin, commit, flush, parse, rollback, sync)
src/Database/PostgreSQL/Pure/Parser.hs view
@@ -2,4 +2,4 @@ ( column ) where -import Database.PostgreSQL.Pure.Internal.Parser (column)+import Database.PostgreSQL.Pure.Internal.Parser (column)
template/Builder.hs view
@@ -1,549 +1,554 @@-{-# LANGUAGE CPP #-} -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE PatternSynonyms #-} -{-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE TypeSynonymInstances #-} -{-# LANGUAGE UndecidableInstances #-} - -{-# OPTIONS_GHC -Wno-orphans #-} - -#include "MachDeps.h" - -module Database.PostgreSQL.Pure.Internal.Builder - ( startup - , password - , terminate - , query - , parse - , bind - , execute - , describePreparedStatement - , describePortal - , flush - , sync - , closePreparedStatement - , closePortal - ) where - -import Database.PostgreSQL.Pure.Internal.Data (BindParameterFormatCodes (BindParameterFormatCodesAll, BindParameterFormatCodesAllDefault, BindParameterFormatCodesEach), - BindResultFormatCodes (BindResultFormatCodesAllDefault, BindResultFormatCodesEach, BindResultFormatCodesNothing), - FormatCode (BinaryFormat, TextFormat), Oid (Oid), - PortalName (PortalName), - PreparedStatementName (PreparedStatementName), - Query (Query), ToField (toField), - ToRecord (toRecord)) -import Database.PostgreSQL.Pure.Internal.Exception (cantReachHere) -import qualified Database.PostgreSQL.Pure.Internal.MonadFail as MonadFail -import qualified Database.PostgreSQL.Pure.Oid as Oid -import qualified Database.PostgreSQL.Simple.Time.Internal.Printer as Time - -import Control.Exception.Safe (assert) -import qualified Data.Bool as B -import qualified Data.ByteString as BS -import qualified Data.ByteString.Builder as BSB -import qualified Data.ByteString.Builder.Prim as BSBP -import qualified Data.ByteString.Lazy as BSL -import qualified Data.Double.Conversion.ByteString as DC -import Data.Fixed (Fixed (MkFixed), HasResolution, Pico, resolution) -import Data.Int (Int16, Int32, Int64) -import qualified Data.Map.Strict as M -import Data.Scientific (FPFormat (Exponent), Scientific, formatScientific, - scientific) -import Data.Time (Day, DiffTime, NominalDiffTime, TimeOfDay, TimeZone, - UTCTime) -import Data.Time.LocalTime (LocalTime) -import Data.Tuple.Single (Single, pattern Single) -import qualified PostgreSQL.Binary.Encoding as BE - -startup - :: String -- ^ user name. ASCII text. - -> String -- ^ database name. ASCII text. - -> BSB.Builder -startup user database = - let - len = - 4 -- length field - + 2 -- protocol major version - + 2 -- protocol minor version - + 5 -- "user\0" - + length user - + 1 -- '\0' - + 9 -- "database\0" - + length database - + 1 -- '\0' - + 1 -- '\0' - in - BSB.int32BE (fromIntegral len) - <> BSB.int16BE 3 -- protocol major version - <> BSB.int16BE 0 -- protocol minor version - <> BSB.string7 "user\0" - <> BSB.string7 user - <> BSB.char7 '\0' - <> BSB.string7 "database\0" <> BSB.string7 database <> BSB.char7 '\0' - <> BSB.char7 '\0' - -password - :: BS.ByteString -- ^ password, which may be hashed. ASCII text. - -> BSB.Builder -password password = - let - len = 4 + BS.length password + 1 - in - BSB.char7 'p' - <> BSB.int32BE (fromIntegral len) - <> BSB.byteString password - <> BSB.char7 '\0' - -query :: Query -> BSB.Builder -query (Query q) = - let - len = 4 + BS.length q + 1 - in - BSB.char7 'Q' - <> BSB.int32BE (fromIntegral len) - <> BSB.byteString q - <> BSB.char7 '\0' - -terminate :: BS.ByteString -terminate = BS.pack [0x58, 0, 0, 0, 4] - -parse - :: PreparedStatementName - -> Query - -> [Oid] -- ^ OIDs of data types of parameters - -> BSB.Builder -parse (PreparedStatementName name) (Query q) oids = - let - len = 4 + BS.length name + 1 + BS.length q + 1 + 2 + noids * 4 - noids = length oids - in - BSB.char7 'P' - <> BSB.int32BE (fromIntegral len) - <> BSB.byteString name - <> BSB.char7 '\0' - <> BSB.byteString q - <> BSB.char7 '\0' - <> BSB.int16BE (fromIntegral noids) - <> mconcat (BSB.int32BE . (\(Oid n) -> n) <$> oids) - -bind - :: PortalName - -> PreparedStatementName - -> BindParameterFormatCodes - -> [Maybe BS.ByteString] - -> BindResultFormatCodes - -> BSB.Builder -bind (PortalName portalName) (PreparedStatementName preparedStatementName) parameterFormatCodes parameters resultFormatCodes = - let - len = - 4 -- length field - + BS.length portalName - + 1 -- '\0' - + BS.length preparedStatementName - + 1 -- '\0' - + 2 -- the number of parameter format codes - + ( case parameterFormatCodes of -- format codes - BindParameterFormatCodesAllDefault -> 0 - BindParameterFormatCodesAll _ -> 2 - BindParameterFormatCodesEach cs -> 2 * length cs - ) - + 2 -- the number of parameters - + 4 * length parameters -- length field of each parameters - + sum ((\p -> case p of Just bs -> BS.length bs; Nothing -> 0) <$> parameters) -- parameters themselves - + 2 -- the number of result format codes - + ( case resultFormatCodes of -- format codes - BindResultFormatCodesNothing -> 0 - BindResultFormatCodesAllDefault -> 0 - BindResultFormatCodesEach cs -> 2 * length cs - ) - in - BSB.char7 'B' - <> BSB.int32BE (fromIntegral len) - <> BSB.byteString portalName - <> BSB.char7 '\0' - <> BSB.byteString preparedStatementName - <> BSB.char7 '\0' - <> ( case parameterFormatCodes of - BindParameterFormatCodesAllDefault -> BSB.int16BE 0 - BindParameterFormatCodesAll c -> BSB.int16BE 1 <> BSB.int16BE (fromIntegral $ fromEnum c) - BindParameterFormatCodesEach cs -> BSB.int16BE (fromIntegral $ length cs) <> mconcat (BSB.int16BE . fromIntegral . fromEnum <$> cs) - ) - <> BSB.int16BE (fromIntegral $ length parameters) - <> mconcat - ( ( \p -> - case p of - Just bs -> BSB.int32BE (fromIntegral $ BS.length bs) <> BSB.byteString bs - Nothing -> BSB.int32BE (-1) - ) <$> parameters - ) - <> ( case resultFormatCodes of - BindResultFormatCodesNothing -> BSB.int16BE 0 - BindResultFormatCodesAllDefault -> BSB.int16BE 1 - BindResultFormatCodesEach cs -> BSB.int16BE (fromIntegral $ length cs) <> mconcat (BSB.int16BE . fromIntegral . fromEnum <$> cs) - ) - -execute - :: PortalName - -> Int -- ^ limit of the number of rows - -> BSB.Builder -execute (PortalName name) limitRows = - let - len = 4 + BS.length name + 1 + 4 - in - BSB.char7 'E' - <> BSB.int32BE (fromIntegral len) - <> BSB.byteString name - <> BSB.char7 '\0' - <> BSB.int32BE (fromIntegral limitRows) - -flush :: BS.ByteString -flush = BS.pack [0x48, 0, 0, 0, 4] - -sync :: BS.ByteString -sync = BS.pack [0x53, 0, 0, 0, 4] - -describePreparedStatement :: PreparedStatementName -> BSB.Builder -describePreparedStatement (PreparedStatementName name) = doDescribe 'S' name - -closePreparedStatement :: PreparedStatementName -> BSB.Builder -closePreparedStatement (PreparedStatementName name) = doClose 'S' name - -describePortal :: PortalName -> BSB.Builder -describePortal (PortalName name) = doDescribe 'P' name - -closePortal :: PortalName -> BSB.Builder -closePortal (PortalName name) = doClose 'P' name - -doDescribe :: Char -> BS.ByteString -> BSB.Builder -doDescribe typ name = - let - len = 4 + 1 + BS.length name + 1 - in - BSB.char7 'D' - <> BSB.int32BE (fromIntegral len) - <> BSB.char7 typ - <> BSB.byteString name - <> BSB.char7 '\0' - -doClose :: Char -> BS.ByteString -> BSB.Builder -doClose typ name = - let - len = 4 + 1 + BS.length name + 1 - in - BSB.char7 'C' - <> BSB.int32BE (fromIntegral len) - <> BSB.char7 typ - <> BSB.byteString name - <> BSB.char7 '\0' - -instance ToField () where - toField _ _ _ _ _ = fail "no values for units" - -instance ToField Bool where - toField _ _ Nothing TextFormat = pure . Just . B.bool "TRUE" "FALSE" - toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.bool - toField backendParams encode (Just o) f | o == Oid.bool = toField backendParams encode Nothing f - | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: Bool" - -instance ToField Int where -#if WORD_SIZE_IN_BITS > 64 - toField _ _ _ _ _ = fail "the Int's size is too large, larger then 64 bits" -#else - toField _ _ Nothing TextFormat = pure . Just. BSL.toStrict . BSB.toLazyByteString . BSB.intDec -#if WORD_SIZE_IN_BITS > 32 - toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.int8_int64 . fromIntegral - toField backendParams encode (Just o) TextFormat | o == Oid.int8 = toField backendParams encode Nothing TextFormat - toField backendParams encode (Just o) BinaryFormat | o == Oid.int8 = toField backendParams encode Nothing BinaryFormat -#else /* the width of Int is wider than 30 bits */ - toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.int4_int32 . fromIntegral - toField backendParams encode (Just o) TextFormat | o `elem` [Oid.int4, Oid.int8] = toField backendParams encode Nothing TextFormat - toField backendParams encode (Just o) BinaryFormat | o == Oid.int4 = toField backendParams encode Nothing BinaryFormat - | o == Oid.int8 = pure . Just . BE.encodingBytes . BE.int8_int64 . fromIntegral -#endif - toField _ _ (Just o) _ = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: Int" -#endif - -instance ToField Int16 where - toField _ _ Nothing TextFormat = pure . Just . BSL.toStrict . BSB.toLazyByteString . BSB.int16Dec - toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.int2_int16 - toField backendParams encode (Just o) f | o == Oid.int2 = toField backendParams encode Nothing f - | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: Int16" - -instance ToField Int32 where - toField _ _ Nothing TextFormat = pure . Just . BSL.toStrict . BSB.toLazyByteString . BSB.int32Dec - toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.int4_int32 - toField backendParams encode (Just o) TextFormat | o `elem` [Oid.int4, Oid.int8] = toField backendParams encode Nothing TextFormat - toField backendParams encode (Just o) BinaryFormat | o == Oid.int4 = toField backendParams encode Nothing BinaryFormat - | o == Oid.int8 = pure . Just . BE.encodingBytes . BE.int8_int64 . fromIntegral - toField _ _ (Just o) _ = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: Int32" - -instance ToField Int64 where - toField _ _ Nothing TextFormat = pure . Just . BSL.toStrict . BSB.toLazyByteString . BSB.int64Dec - toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.int8_int64 - toField backendParams encode (Just o) f | o == Oid.int8 = toField backendParams encode Nothing f - | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: Int64" - -instance ToField Float where - toField _ _ Nothing TextFormat = pure . Just . DC.toShortest . realToFrac - toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.float4 - toField backendParams encode (Just o) TextFormat | o `elem` [Oid.float4, Oid.float8] = toField backendParams encode Nothing TextFormat - toField backendParams encode (Just o) BinaryFormat | o == Oid.float4 = toField backendParams encode Nothing BinaryFormat - | o == Oid.float8 = pure . Just . BE.encodingBytes . BE.float8 . realToFrac - toField _ _ (Just o) _ = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: Float" - -instance ToField Double where - toField _ _ Nothing TextFormat = pure . Just . DC.toShortest - toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.float8 - toField backendParams encode (Just o) f | o == Oid.float8 = toField backendParams encode Nothing f - | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: Double" - -instance ToField Scientific where - toField _ encode Nothing TextFormat = (Just <$>) . MonadFail.fromEither . encode . formatScientific Exponent Nothing - toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.numeric - toField backendParams encode (Just o) f | o == Oid.numeric = toField backendParams encode Nothing f - | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: Scientific" - -instance HasResolution a => ToField (Fixed a) where - toField _ encode Nothing TextFormat v = Just <$> MonadFail.fromEither (encode (show v)) -- XXX maybe slow - toField _ _ Nothing BinaryFormat v@(MkFixed i) = pure $ Just $ BE.encodingBytes $ BE.numeric $ scientific i (fromInteger $ resolution v) - toField backendParams encode (Just o) f v | o == Oid.numeric = toField backendParams encode Nothing f v - | otherwise = fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: Fixed a (" <> show (resolution v) <> ")" - -instance ToField Char where - toField _ encode Nothing _ v = Just <$> MonadFail.fromEither (encode [v]) - toField backendParams encode (Just o) f v | o == Oid.char = toField backendParams encode Nothing f v - | otherwise = fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: Char" - -instance ToField String where - toField _ encode Nothing _ = (Just <$>) . MonadFail.fromEither . encode - toField backendParams encode (Just _) TextFormat = toField backendParams encode Nothing TextFormat - toField backendParams encode (Just o) BinaryFormat | o `elem` [Oid.text, Oid.bpchar, Oid.varchar, Oid.name] = toField backendParams encode Nothing BinaryFormat - | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: String" - -instance ToField BS.ByteString where - toField _ _ Nothing _ = pure . Just - toField backendParams encode (Just o) f | o `elem` [Oid.text, Oid.bpchar, Oid.varchar, Oid.name, Oid.bytea] = toField backendParams encode Nothing f - | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: ByteString (strict)" - -instance ToField Day where -- TODO infinity/-infinity - toField _ _ Nothing TextFormat = pure . Just . BSL.toStrict . BSB.toLazyByteString . BSBP.primBounded Time.day - toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.date - toField backendParams encode (Just o) f | o == Oid.date = toField backendParams encode Nothing f - | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: Day" - -instance ToField TimeOfDay where - toField _ _ Nothing TextFormat = pure . Just . BSL.toStrict . BSB.toLazyByteString . BSBP.primBounded Time.timeOfDay - toField backendParams _ Nothing BinaryFormat = - case M.lookup "integer_datetimes" backendParams of - Nothing -> const $ fail "not found \"integer_datetimes\" backend parameter" - Just "on" -> pure . Just . BE.encodingBytes . BE.time_int - Just "off" -> pure . Just . BE.encodingBytes . BE.time_float - Just v -> const $ fail $ "\"integer_datetimes\" has unrecognized value: " <> show v - toField backendParams encode (Just o) f | o == Oid.time = toField backendParams encode Nothing f - | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: TimeOfDay" - -instance ToField (TimeOfDay, TimeZone) where - toField _ _ Nothing TextFormat = pure . Just . BSL.toStrict . BSB.toLazyByteString . BSBP.primBounded (Time.timeOfDay BSBP.>*< Time.timeZone) - toField backendParams _ Nothing BinaryFormat = - case M.lookup "integer_datetimes" backendParams of - Nothing -> const $ fail "not found \"integer_datetimes\" backend parameter" - Just "on" -> pure . Just . BE.encodingBytes . BE.timetz_int - Just "off" -> pure . Just . BE.encodingBytes . BE.timetz_float - Just v -> const $ fail $ "\"integer_datetimes\" has unrecognized value: " <> show v - toField backendParams encode (Just o) f | o == Oid.timetz = toField backendParams encode Nothing f - | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: (TimeOfDay, TimeZone)" - -instance ToField LocalTime where - toField _ _ Nothing TextFormat = pure . Just . BSL.toStrict . BSB.toLazyByteString . BSBP.primBounded Time.localTime - toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.timestamp_int - toField backendParams encode (Just o) f | o == Oid.timestamp = toField backendParams encode Nothing f - | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: LocalTime" - -instance ToField UTCTime where - toField _ _ Nothing TextFormat = pure . Just . BSL.toStrict . BSB.toLazyByteString . BSBP.primBounded Time.utcTime - toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.timestamptz_int - toField backendParams encode (Just o) f | o == Oid.timestamptz = toField backendParams encode Nothing f - | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: UTCTime" - -instance ToField DiffTime where - toField _ encode Nothing TextFormat = (Just <$>) . MonadFail.fromEither . encode . show -- XXX maybe slow - toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.interval_int - toField backendParams encode (Just o) f | o == Oid.interval = toField backendParams encode Nothing f - | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: DiffTime" - -instance ToField NominalDiffTime where - toField backendParams encode Nothing f = toField backendParams encode Nothing f . (realToFrac :: NominalDiffTime -> Pico) - toField backendParams encode (Just o) f | o == Oid.numeric = toField backendParams encode Nothing f - | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: NominalDiffTime" - -instance ToField Oid where - toField _ _ Nothing TextFormat (Oid v) = pure $ Just $ BSL.toStrict $ BSB.toLazyByteString $ BSB.int32Dec v - toField _ _ Nothing BinaryFormat (Oid v) = pure $ Just $ BE.encodingBytes $ BE.int4_int32 v - toField backendParams encode (Just o) f v | o == Oid.oid = toField backendParams encode Nothing f v - | otherwise = fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: Oid" - --- 0 tuple -instance ToRecord () where - toRecord _ _ Nothing [] _ = - pure [] - toRecord _ _ Nothing fs _ = - fail $ "the number of format codes must be 0, actually " <> show (length fs) - toRecord _ _ (Just []) [] _ = - pure [] - toRecord _ _ (Just os) [] _ = - fail $ "the number of OIDs must be 0, actually " <> show (length os) - toRecord _ _ _ fs _ = - fail $ "the number of format codes must be 0, actually " <> show (length fs) - --- 1 tuple -instance - {-# OVERLAPPABLE #-} - (ToField a, Single c, t ~ c a) - => ToRecord t where - toRecord backendParams encode Nothing [f] (Single v) = - sequence [toField backendParams encode Nothing f v] - toRecord _ _ Nothing [_] _ = - cantReachHere - toRecord backendParams encode (Just [o]) [f] (Single v) = - sequence [toField backendParams encode (Just o) f v] - toRecord _ _ (Just os) [_] _ = - fail $ "the number of OIDs must be 1, actually " <> show (length os) - toRecord _ _ _ fs _ = - fail $ "the number of format codes must be 1, actually " <> show (length fs) - ----- embed 2 - ----- embed 3 - ----- embed 4 - ----- embed 5 - ----- embed 6 - ----- embed 7 - ----- embed 8 - ----- embed 9 - ----- embed 10 - ----- embed 11 - ----- embed 12 - ----- embed 13 - ----- embed 14 - ----- embed 15 - ----- embed 16 - ----- embed 17 - ----- embed 18 - ----- embed 19 - ----- embed 20 - ----- embed 21 - ----- embed 22 - ----- embed 23 - ----- embed 24 - ----- embed 25 - ----- embed 26 - ----- embed 27 - ----- embed 28 - ----- embed 29 - ----- embed 30 - ----- embed 31 - ----- embed 32 - ----- embed 33 - ----- embed 34 - ----- embed 35 - ----- embed 36 - ----- embed 37 - ----- embed 38 - ----- embed 39 - ----- embed 40 - ----- embed 41 - ----- embed 42 - ----- embed 43 - ----- embed 44 - ----- embed 45 - ----- embed 46 - ----- embed 47 - ----- embed 48 - ----- embed 49 - ----- embed 50 - ----- embed 51 - ----- embed 52 - ----- embed 53 - ----- embed 54 - ----- embed 55 - ----- embed 56 - ----- embed 57 - ----- embed 58 - ----- embed 59 - ----- embed 60 - ----- embed 61 - ----- embed 62 - --- list -instance - {-# OVERLAPPING #-} - ToField a - => ToRecord [a] where - toRecord backendParams encode Nothing fs vs = - sequence $ uncurry (toField backendParams encode Nothing) <$> zip fs vs - toRecord backendParams encode (Just os) fs vs = - assert (length os == length fs && length fs == length vs) $ sequence $ uncurry3 (toField backendParams encode) <$> zip3 (Just <$> os) fs vs - -uncurry3 :: (a -> b -> c -> d) -> (a, b, c) -> d -uncurry3 f (a, b, c) = f a b c +{-# LANGUAGE CPP #-}+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE PatternSynonyms #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE TypeSynonymInstances #-}+{-# LANGUAGE UndecidableInstances #-}++{-# OPTIONS_GHC -Wno-orphans #-}++#include "MachDeps.h"++module Database.PostgreSQL.Pure.Internal.Builder+ ( startup+ , password+ , terminate+ , query+ , parse+ , bind+ , execute+ , describePreparedStatement+ , describePortal+ , flush+ , sync+ , closePreparedStatement+ , closePortal+ ) where++import Database.PostgreSQL.Pure.Internal.Data (BindParameterFormatCodes (BindParameterFormatCodesAll, BindParameterFormatCodesAllDefault, BindParameterFormatCodesEach),+ BindResultFormatCodes (BindResultFormatCodesAllDefault, BindResultFormatCodesEach, BindResultFormatCodesNothing),+ FormatCode (BinaryFormat, TextFormat), Oid (Oid),+ PortalName (PortalName),+ PreparedStatementName (PreparedStatementName),+ Query (Query), TimeOfDayWithTimeZone (TimeOfDayWithTimeZone), ToField (toField),+ ToRecord (toRecord))+import Database.PostgreSQL.Pure.Internal.Exception (cantReachHere)+import qualified Database.PostgreSQL.Pure.Internal.MonadFail as MonadFail+import qualified Database.PostgreSQL.Pure.Oid as Oid+import qualified Database.PostgreSQL.Simple.Time.Internal.Printer as Time++import Control.Exception.Safe (assert)+import qualified Data.Bool as B+import qualified Data.ByteString as BS+import qualified Data.ByteString.Builder as BSB+import qualified Data.ByteString.Builder.Prim as BSBP+import qualified Data.ByteString.Lazy as BSL+import qualified Data.Double.Conversion.ByteString as DC+import Data.Fixed (Fixed (MkFixed), HasResolution, Pico, resolution)+import Data.Int (Int16, Int32, Int64)+import qualified Data.Map.Strict as M+import Data.Scientific (FPFormat (Exponent), Scientific, formatScientific,+ scientific)+import Data.Time (Day, DiffTime, NominalDiffTime, TimeOfDay,+ UTCTime)+import Data.Time.LocalTime (LocalTime)+import Data.Tuple.Single (Single, pattern Single)+import qualified PostgreSQL.Binary.Encoding as BE++startup+ :: String -- ^ user name. ASCII text.+ -> String -- ^ database name. ASCII text.+ -> BSB.Builder+startup user database =+ let+ len =+ 4 -- length field+ + 2 -- protocol major version+ + 2 -- protocol minor version+ + 5 -- "user\0"+ + length user+ + 1 -- '\0'+ + 9 -- "database\0"+ + length database+ + 1 -- '\0'+ + 1 -- '\0'+ in+ BSB.int32BE (fromIntegral len)+ <> BSB.int16BE 3 -- protocol major version+ <> BSB.int16BE 0 -- protocol minor version+ <> BSB.string7 "user\0"+ <> BSB.string7 user+ <> BSB.char7 '\0'+ <> BSB.string7 "database\0" <> BSB.string7 database <> BSB.char7 '\0'+ <> BSB.char7 '\0'++password+ :: BS.ByteString -- ^ password, which may be hashed. ASCII text.+ -> BSB.Builder+password password =+ let+ len = 4 + BS.length password + 1+ in+ BSB.char7 'p'+ <> BSB.int32BE (fromIntegral len)+ <> BSB.byteString password+ <> BSB.char7 '\0'++query :: Query -> BSB.Builder+query (Query q) =+ let+ len = 4 + BS.length q + 1+ in+ BSB.char7 'Q'+ <> BSB.int32BE (fromIntegral len)+ <> BSB.byteString q+ <> BSB.char7 '\0'++terminate :: BS.ByteString+terminate = BS.pack [0x58, 0, 0, 0, 4]++parse+ :: PreparedStatementName+ -> Query+ -> [Oid] -- ^ OIDs of data types of parameters+ -> BSB.Builder+parse (PreparedStatementName name) (Query q) oids =+ let+ len = 4 + BS.length name + 1 + BS.length q + 1 + 2 + noids * 4+ noids = length oids+ in+ BSB.char7 'P'+ <> BSB.int32BE (fromIntegral len)+ <> BSB.byteString name+ <> BSB.char7 '\0'+ <> BSB.byteString q+ <> BSB.char7 '\0'+ <> BSB.int16BE (fromIntegral noids)+ <> mconcat (BSB.int32BE . (\(Oid n) -> n) <$> oids)++bind+ :: PortalName+ -> PreparedStatementName+ -> BindParameterFormatCodes+ -> [Maybe BS.ByteString]+ -> BindResultFormatCodes+ -> BSB.Builder+bind (PortalName portalName) (PreparedStatementName preparedStatementName) parameterFormatCodes parameters resultFormatCodes =+ let+ len =+ 4 -- length field+ + BS.length portalName+ + 1 -- '\0'+ + BS.length preparedStatementName+ + 1 -- '\0'+ + 2 -- the number of parameter format codes+ + ( case parameterFormatCodes of -- format codes+ BindParameterFormatCodesAllDefault -> 0+ BindParameterFormatCodesAll _ -> 2+ BindParameterFormatCodesEach cs -> 2 * length cs+ )+ + 2 -- the number of parameters+ + 4 * length parameters -- length field of each parameters+ + sum ((\p -> case p of Just bs -> BS.length bs; Nothing -> 0) <$> parameters) -- parameters themselves+ + 2 -- the number of result format codes+ + ( case resultFormatCodes of -- format codes+ BindResultFormatCodesNothing -> 0+ BindResultFormatCodesAllDefault -> 0+ BindResultFormatCodesEach cs -> 2 * length cs+ )+ in+ BSB.char7 'B'+ <> BSB.int32BE (fromIntegral len)+ <> BSB.byteString portalName+ <> BSB.char7 '\0'+ <> BSB.byteString preparedStatementName+ <> BSB.char7 '\0'+ <> ( case parameterFormatCodes of+ BindParameterFormatCodesAllDefault -> BSB.int16BE 0+ BindParameterFormatCodesAll c -> BSB.int16BE 1 <> BSB.int16BE (fromIntegral $ fromEnum c)+ BindParameterFormatCodesEach cs -> BSB.int16BE (fromIntegral $ length cs) <> mconcat (BSB.int16BE . fromIntegral . fromEnum <$> cs)+ )+ <> BSB.int16BE (fromIntegral $ length parameters)+ <> mconcat+ ( ( \p ->+ case p of+ Just bs -> BSB.int32BE (fromIntegral $ BS.length bs) <> BSB.byteString bs+ Nothing -> BSB.int32BE (-1)+ ) <$> parameters+ )+ <> ( case resultFormatCodes of+ BindResultFormatCodesNothing -> BSB.int16BE 0+ BindResultFormatCodesAllDefault -> BSB.int16BE 1+ BindResultFormatCodesEach cs -> BSB.int16BE (fromIntegral $ length cs) <> mconcat (BSB.int16BE . fromIntegral . fromEnum <$> cs)+ )++execute+ :: PortalName+ -> Int -- ^ limit of the number of rows+ -> BSB.Builder+execute (PortalName name) limitRows =+ let+ len = 4 + BS.length name + 1 + 4+ in+ BSB.char7 'E'+ <> BSB.int32BE (fromIntegral len)+ <> BSB.byteString name+ <> BSB.char7 '\0'+ <> BSB.int32BE (fromIntegral limitRows)++flush :: BS.ByteString+flush = BS.pack [0x48, 0, 0, 0, 4]++sync :: BS.ByteString+sync = BS.pack [0x53, 0, 0, 0, 4]++describePreparedStatement :: PreparedStatementName -> BSB.Builder+describePreparedStatement (PreparedStatementName name) = doDescribe 'S' name++closePreparedStatement :: PreparedStatementName -> BSB.Builder+closePreparedStatement (PreparedStatementName name) = doClose 'S' name++describePortal :: PortalName -> BSB.Builder+describePortal (PortalName name) = doDescribe 'P' name++closePortal :: PortalName -> BSB.Builder+closePortal (PortalName name) = doClose 'P' name++doDescribe :: Char -> BS.ByteString -> BSB.Builder+doDescribe typ name =+ let+ len = 4 + 1 + BS.length name + 1+ in+ BSB.char7 'D'+ <> BSB.int32BE (fromIntegral len)+ <> BSB.char7 typ+ <> BSB.byteString name+ <> BSB.char7 '\0'++doClose :: Char -> BS.ByteString -> BSB.Builder+doClose typ name =+ let+ len = 4 + 1 + BS.length name + 1+ in+ BSB.char7 'C'+ <> BSB.int32BE (fromIntegral len)+ <> BSB.char7 typ+ <> BSB.byteString name+ <> BSB.char7 '\0'++instance ToField () where+ toField _ _ _ _ _ = fail "no values for units"++instance ToField Bool where+ toField _ _ Nothing TextFormat = pure . Just . B.bool "TRUE" "FALSE"+ toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.bool+ toField backendParams encode (Just o) f | o == Oid.bool = toField backendParams encode Nothing f+ | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: Bool"++instance ToField Int where+#if WORD_SIZE_IN_BITS > 64+ toField _ _ _ _ _ = fail "the Int's size is too large, larger then 64 bits"+#else+ toField _ _ Nothing TextFormat = pure . Just. BSL.toStrict . BSB.toLazyByteString . BSB.intDec+#if WORD_SIZE_IN_BITS > 32+ toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.int8_int64 . fromIntegral+ toField backendParams encode (Just o) TextFormat | o == Oid.int8 = toField backendParams encode Nothing TextFormat+ toField backendParams encode (Just o) BinaryFormat | o == Oid.int8 = toField backendParams encode Nothing BinaryFormat+#else /* the width of Int is wider than 30 bits */+ toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.int4_int32 . fromIntegral+ toField backendParams encode (Just o) TextFormat | o `elem` [Oid.int4, Oid.int8] = toField backendParams encode Nothing TextFormat+ toField backendParams encode (Just o) BinaryFormat | o == Oid.int4 = toField backendParams encode Nothing BinaryFormat+ | o == Oid.int8 = pure . Just . BE.encodingBytes . BE.int8_int64 . fromIntegral+#endif+ toField _ _ (Just o) _ = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: Int"+#endif++instance ToField Int16 where+ toField _ _ Nothing TextFormat = pure . Just . BSL.toStrict . BSB.toLazyByteString . BSB.int16Dec+ toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.int2_int16+ toField backendParams encode (Just o) f | o == Oid.int2 = toField backendParams encode Nothing f+ | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: Int16"++instance ToField Int32 where+ toField _ _ Nothing TextFormat = pure . Just . BSL.toStrict . BSB.toLazyByteString . BSB.int32Dec+ toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.int4_int32+ toField backendParams encode (Just o) TextFormat | o `elem` [Oid.int4, Oid.int8] = toField backendParams encode Nothing TextFormat+ toField backendParams encode (Just o) BinaryFormat | o == Oid.int4 = toField backendParams encode Nothing BinaryFormat+ | o == Oid.int8 = pure . Just . BE.encodingBytes . BE.int8_int64 . fromIntegral+ toField _ _ (Just o) _ = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: Int32"++instance ToField Int64 where+ toField _ _ Nothing TextFormat = pure . Just . BSL.toStrict . BSB.toLazyByteString . BSB.int64Dec+ toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.int8_int64+ toField backendParams encode (Just o) f | o == Oid.int8 = toField backendParams encode Nothing f+ | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: Int64"++instance ToField Float where+ toField _ _ Nothing TextFormat = pure . Just . DC.toShortest . realToFrac+ toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.float4+ toField backendParams encode (Just o) TextFormat | o `elem` [Oid.float4, Oid.float8] = toField backendParams encode Nothing TextFormat+ toField backendParams encode (Just o) BinaryFormat | o == Oid.float4 = toField backendParams encode Nothing BinaryFormat+ | o == Oid.float8 = pure . Just . BE.encodingBytes . BE.float8 . realToFrac+ toField _ _ (Just o) _ = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: Float"++instance ToField Double where+ toField _ _ Nothing TextFormat = pure . Just . DC.toShortest+ toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.float8+ toField backendParams encode (Just o) f | o == Oid.float8 = toField backendParams encode Nothing f+ | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: Double"++instance ToField Scientific where+ toField _ encode Nothing TextFormat = (Just <$>) . MonadFail.fromEither . encode . formatScientific Exponent Nothing+ toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.numeric+ toField backendParams encode (Just o) f | o == Oid.numeric = toField backendParams encode Nothing f+ | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: Scientific"++instance HasResolution a => ToField (Fixed a) where+ toField _ encode Nothing TextFormat v = Just <$> MonadFail.fromEither (encode (show v)) -- XXX maybe slow+ toField _ _ Nothing BinaryFormat v@(MkFixed i) = pure $ Just $ BE.encodingBytes $ BE.numeric $ scientific i (fromInteger $ resolution v)+ toField backendParams encode (Just o) f v | o == Oid.numeric = toField backendParams encode Nothing f v+ | otherwise = fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: Fixed a (" <> show (resolution v) <> ")"++instance ToField Char where+ toField _ encode Nothing _ v = Just <$> MonadFail.fromEither (encode [v])+ toField backendParams encode (Just o) f v | o == Oid.char = toField backendParams encode Nothing f v+ | otherwise = fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: Char"++instance ToField String where+ toField _ encode Nothing _ = (Just <$>) . MonadFail.fromEither . encode+ toField backendParams encode (Just _) TextFormat = toField backendParams encode Nothing TextFormat+ toField backendParams encode (Just o) BinaryFormat | o `elem` [Oid.text, Oid.bpchar, Oid.varchar, Oid.name] = toField backendParams encode Nothing BinaryFormat+ | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: String"++instance ToField BS.ByteString where+ toField _ _ Nothing _ = pure . Just+ toField backendParams encode (Just o) f | o `elem` [Oid.text, Oid.bpchar, Oid.varchar, Oid.name, Oid.bytea] = toField backendParams encode Nothing f+ | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: ByteString (strict)"++instance ToField Day where -- TODO infinity/-infinity+ toField _ _ Nothing TextFormat = pure . Just . BSL.toStrict . BSB.toLazyByteString . BSBP.primBounded Time.day+ toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.date+ toField backendParams encode (Just o) f | o == Oid.date = toField backendParams encode Nothing f+ | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: Day"++instance ToField TimeOfDay where+ toField _ _ Nothing TextFormat = pure . Just . BSL.toStrict . BSB.toLazyByteString . BSBP.primBounded Time.timeOfDay+ toField backendParams _ Nothing BinaryFormat =+ case M.lookup "integer_datetimes" backendParams of+ Nothing -> const $ fail "not found \"integer_datetimes\" backend parameter"+ Just "on" -> pure . Just . BE.encodingBytes . BE.time_int+ Just "off" -> pure . Just . BE.encodingBytes . BE.time_float+ Just v -> const $ fail $ "\"integer_datetimes\" has unrecognized value: " <> show v+ toField backendParams encode (Just o) f | o == Oid.time = toField backendParams encode Nothing f+ | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: TimeOfDay"++instance ToField TimeOfDayWithTimeZone where+ toField _ _ Nothing TextFormat = pure . Just . BSL.toStrict . BSB.toLazyByteString . BSBP.primBounded (go BSBP.>$< Time.timeOfDay BSBP.>*< Time.timeZone)+ where go (TimeOfDayWithTimeZone t tz) = (t, tz)+ toField backendParams _ Nothing BinaryFormat =+ case M.lookup "integer_datetimes" backendParams of+ Nothing -> const $ fail "not found \"integer_datetimes\" backend parameter"+ Just "on" -> pure . Just . BE.encodingBytes . BE.timetz_int . \(TimeOfDayWithTimeZone t tz) -> (t, tz)+ Just "off" -> pure . Just . BE.encodingBytes . BE.timetz_float . \(TimeOfDayWithTimeZone t tz) -> (t, tz)+ Just v -> const $ fail $ "\"integer_datetimes\" has unrecognized value: " <> show v+ toField backendParams encode (Just o) f | o == Oid.timetz = toField backendParams encode Nothing f+ | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: TimeOfDayWithTimeZone)"++instance ToField LocalTime where+ toField _ _ Nothing TextFormat = pure . Just . BSL.toStrict . BSB.toLazyByteString . BSBP.primBounded Time.localTime+ toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.timestamp_int+ toField backendParams encode (Just o) f | o == Oid.timestamp = toField backendParams encode Nothing f+ | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: LocalTime"++instance ToField UTCTime where+ toField _ _ Nothing TextFormat = pure . Just . BSL.toStrict . BSB.toLazyByteString . BSBP.primBounded Time.utcTime+ toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.timestamptz_int+ toField backendParams encode (Just o) f | o == Oid.timestamptz = toField backendParams encode Nothing f+ | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: UTCTime"++instance ToField DiffTime where+ toField _ encode Nothing TextFormat = (Just <$>) . MonadFail.fromEither . encode . show -- XXX maybe slow+ toField _ _ Nothing BinaryFormat = pure . Just . BE.encodingBytes . BE.interval_int+ toField backendParams encode (Just o) f | o == Oid.interval = toField backendParams encode Nothing f+ | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: DiffTime"++instance ToField NominalDiffTime where+ toField backendParams encode Nothing f = toField backendParams encode Nothing f . (realToFrac :: NominalDiffTime -> Pico)+ toField backendParams encode (Just o) f | o == Oid.numeric = toField backendParams encode Nothing f+ | otherwise = const $ fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: NominalDiffTime"++instance ToField Oid where+ toField _ _ Nothing TextFormat (Oid v) = pure $ Just $ BSL.toStrict $ BSB.toLazyByteString $ BSB.int32Dec v+ toField _ _ Nothing BinaryFormat (Oid v) = pure $ Just $ BE.encodingBytes $ BE.int4_int32 v+ toField backendParams encode (Just o) f v | o == Oid.oid = toField backendParams encode Nothing f v+ | otherwise = fail $ "type mismatch (ToField): OID: " <> show o <> ", Haskell: Oid"++instance ToField a => ToField (Maybe a) where+ toField backendParams encode oid f (Just v) = toField backendParams encode oid f v+ toField _ _ _ _ Nothing = pure $ Just $ BE.encodingBytes $ BE.int4_int32 (-1)++-- 0 tuple+instance ToRecord () where+ toRecord _ _ Nothing [] _ =+ pure []+ toRecord _ _ Nothing fs _ =+ fail $ "the number of format codes must be 0, actually " <> show (length fs)+ toRecord _ _ (Just []) [] _ =+ pure []+ toRecord _ _ (Just os) [] _ =+ fail $ "the number of OIDs must be 0, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 0, actually " <> show (length fs)++-- 1 tuple+instance+ {-# OVERLAPPABLE #-}+ (ToField a, Single c, t ~ c a)+ => ToRecord t where+ toRecord backendParams encode Nothing [f] (Single v) =+ sequence [toField backendParams encode Nothing f v]+ toRecord _ _ Nothing [_] _ =+ cantReachHere+ toRecord backendParams encode (Just [o]) [f] (Single v) =+ sequence [toField backendParams encode (Just o) f v]+ toRecord _ _ (Just os) [_] _ =+ fail $ "the number of OIDs must be 1, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be 1, actually " <> show (length fs)++---- embed 2++---- embed 3++---- embed 4++---- embed 5++---- embed 6++---- embed 7++---- embed 8++---- embed 9++---- embed 10++---- embed 11++---- embed 12++---- embed 13++---- embed 14++---- embed 15++---- embed 16++---- embed 17++---- embed 18++---- embed 19++---- embed 20++---- embed 21++---- embed 22++---- embed 23++---- embed 24++---- embed 25++---- embed 26++---- embed 27++---- embed 28++---- embed 29++---- embed 30++---- embed 31++---- embed 32++---- embed 33++---- embed 34++---- embed 35++---- embed 36++---- embed 37++---- embed 38++---- embed 39++---- embed 40++---- embed 41++---- embed 42++---- embed 43++---- embed 44++---- embed 45++---- embed 46++---- embed 47++---- embed 48++---- embed 49++---- embed 50++---- embed 51++---- embed 52++---- embed 53++---- embed 54++---- embed 55++---- embed 56++---- embed 57++---- embed 58++---- embed 59++---- embed 60++---- embed 61++---- embed 62++-- list+instance+ {-# OVERLAPPING #-}+ ToField a+ => ToRecord [a] where+ toRecord backendParams encode Nothing fs vs =+ sequence $ uncurry (toField backendParams encode Nothing) <$> zip fs vs+ toRecord backendParams encode (Just os) fs vs =+ assert (length os == length fs && length fs == length vs) $ sequence $ uncurry3 (toField backendParams encode) <$> zip3 (Just <$> os) fs vs++uncurry3 :: (a -> b -> c -> d) -> (a, b, c) -> d+uncurry3 f (a, b, c) = f a b c
template/BuilderItem.hs view
@@ -1,10 +1,10 @@--- <length>-tuple -instance <to-field> => ToRecord <type-tuple> where - toRecord backendParams encode Nothing <format-list> <value-tuple> = - sequence <to-field-nothing-list> - toRecord backendParams encode (Just <oid-list>) <format-list> <value-tuple> = - sequence <to-field-just-list> - toRecord _ _ (Just os) _ _ = - fail $ "the number of OIDs must be <length>, actually " <> show (length os) - toRecord _ _ _ fs _ = - fail $ "the number of format codes must be <length>, actually " <> show (length fs) +-- <length>-tuple+instance <to-field> => ToRecord <type-tuple> where+ toRecord backendParams encode Nothing <format-list> <value-tuple> =+ sequence <to-field-nothing-list>+ toRecord backendParams encode (Just <oid-list>) <format-list> <value-tuple> =+ sequence <to-field-just-list>+ toRecord _ _ (Just os) _ _ =+ fail $ "the number of OIDs must be <length>, actually " <> show (length os)+ toRecord _ _ _ fs _ =+ fail $ "the number of format codes must be <length>, actually " <> show (length fs)
template/Parser.hs view
@@ -38,9 +38,11 @@ , skipUntilError , currentPos , column+ , attoparsecParser+ , valueParser ) where -import Database.PostgreSQL.Pure.Internal.Data (AuthenticationMD5Password (AuthenticationMD5Password), AuthenticationResponse (AuthenticationMD5PasswordResponse, AuthenticationOkResponse),+import Database.PostgreSQL.Pure.Internal.Data (AuthenticationMD5Password (AuthenticationMD5Password), AuthenticationResponse (AuthenticationMD5PasswordResponse, AuthenticationOkResponse, AuthenticationCleartextPasswordResponse), BackendKeyData (BackendKeyData), ColumnInfo (ColumnInfo, typeOid), CommandComplete (CommandComplete),@@ -55,7 +57,7 @@ ParameterStatus (ParameterStatus), Raw (Null, Value), ReadyForQuery (ReadyForQuery), Response (..), RowDescription (RowDescription),- SqlIdentifier (SqlIdentifier), StringDecoder,+ SqlIdentifier (SqlIdentifier), StringDecoder, TimeOfDayWithTimeZone (TimeOfDayWithTimeZone), TransactionState (Block, Failed, Idle), TypeLength (FixedLength, VariableLength)) import qualified Database.PostgreSQL.Pure.Internal.Data as Data@@ -84,7 +86,7 @@ import Data.Memory.Endian (BE, ByteSwap, fromBE) import Data.Scientific (Scientific, scientific) import qualified Data.Text as Text-import Data.Time (Day, DiffTime, LocalTime, TimeOfDay, TimeZone,+import Data.Time (Day, DiffTime, LocalTime, TimeOfDay, UTCTime, utc) import Data.Tuple.Single (Single, pattern Single) import Data.Word (Word16, Word32, Word64, Word8)@@ -132,6 +134,7 @@ method <- anyInt32BE case method of 0 -> pure AuthenticationOkResponse+ 3 -> pure AuthenticationCleartextPasswordResponse 5 -> AuthenticationMD5PasswordResponse . AuthenticationMD5Password . BS.copy <$> AP.take 4 t -> fail $ "not yet implemeted authentication type: " <> show t @@ -546,13 +549,13 @@ BinaryFormat -> valueParser BD.time_int v fromField _ ColumnInfo { typeOid } _ = fail $ "type mismatch (FromField): OID: " <> show typeOid <> ", Haskell: TimeOfDay" -instance FromField (TimeOfDay, TimeZone) where+instance FromField TimeOfDayWithTimeZone where fromField _ ColumnInfo { typeOid, Data.formatCode } (Just v) | typeOid == Oid.timetz = case formatCode of- TextFormat -> attoparsecParser ((,) <$> Time.timeOfDay <*> (fromMaybe utc <$> Time.timeZone)) v- BinaryFormat -> valueParser BD.timetz_int v- fromField _ ColumnInfo { typeOid } _ = fail $ "type mismatch (FromField): OID: " <> show typeOid <> ", Haskell: (TimeOfDay, TimeZone)"+ TextFormat -> attoparsecParser (TimeOfDayWithTimeZone <$> Time.timeOfDay <*> (fromMaybe utc <$> Time.timeZone)) v+ BinaryFormat -> valueParser BD.timetz_int v >>= \(t, tz) -> pure $ TimeOfDayWithTimeZone t tz+ fromField _ ColumnInfo { typeOid } _ = fail $ "type mismatch (FromField): OID: " <> show typeOid <> ", Haskell: TimeOfDayWithTimeZone" instance FromField LocalTime where fromField _ ColumnInfo { typeOid, Data.formatCode } (Just v)@@ -591,6 +594,90 @@ fromField decode i v@(Just _) = Just <$> fromField decode i v fromField _ _ Nothing = pure Nothing +instance FromRecord Bool where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord Int where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord Int16 where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord Int32 where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord Int64 where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord Scientific where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord Float where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord Double where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord Oid where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord Char where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord String where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord BS.ByteString where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord Day where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord TimeOfDay where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord TimeOfDayWithTimeZone where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord LocalTime where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord UTCTime where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord DiffTime where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord SqlIdentifier where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromRecord Raw where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)++instance FromField a => FromRecord (Maybe a) where+ fromRecord decode [i] = column decode i+ fromRecord _ is = fail $ "length mismatch: expected 1: actual: " <> show (length is)+ -- 0 tuple instance FromRecord () where fromRecord _ [] = pure ()@@ -724,7 +811,7 @@ ---- embed 62 -- list-instance FromField a => FromRecord [a] where+instance {-# OVERLAPPABLE #-} FromField a => FromRecord [a] where fromRecord decode is = sequence $ column decode <$> is -- | For implementing 'fromRecord'.
test-hdbc-postgresql/SpecificDB.hs view
@@ -7,15 +7,15 @@ import System.Environment(lookupEnv) connectDB = - handleSqlError (do hostString <- getEnvDef "PURE_HOST" "127.0.0.1"- portString <- getEnvDef "PURE_PORT" "5432"+ handleSqlError (do host <- getEnvDef "PURE_HOST" "127.0.0.1"+ port <- getEnvDef "PURE_PORT" "5432" user <- getEnvDef "PURE_USER" "postgres" password <- getEnvDef "PURE_PASSWORD" "" database <- getEnvDef "PURE_DATABASE" "postgres" let config = def- { address = AddressNotResolved hostString portString+ { address = AddressNotResolved host port , user = user , password = password , database = database
test-hdbc-postgresql/SpecificDBTests.hs view
@@ -3,7 +3,7 @@ module SpecificDBTests where import Database.HDBC import Database.HDBC.PostgreSQL.Pure-import Database.HDBC.PostgreSQL.Pure.Parser(convertQuestionMarkStyleToDollarSignStyle)+import Database.PostgreSQL.Placeholder.Convert (convertQuestionMarkStyleToDollarSignStyle) import Test.HUnit testp inp exp = TestCase $
+ test-original/Database/HDBC/PostgreSQL/PureSpec.hs view
@@ -0,0 +1,120 @@+{-# LANGUAGE NamedFieldPuns #-}+{-# LANGUAGE TypeApplications #-}++module Database.HDBC.PostgreSQL.PureSpec (spec) where++import Database.HDBC+import Database.HDBC.PostgreSQL.Pure++import Test.Hspec++import Control.Exception.Safe (try)+import Control.Monad (void)+import Data.Default.Class (Default (def))+import Data.Maybe (fromMaybe)+import System.Environment (lookupEnv)++{-# ANN module ("HLint: ignore Redundant do" :: String) #-}+{-# ANN module ("HLint: ignore Reduce duplication" :: String) #-}++spec :: Spec+spec = do+ beforeAll+ ( do+ host <- getEnvDef "PURE_HOST" "127.0.0.1"+ port <- getEnvDef "PURE_PORT" "5432"+ user <- getEnvDef "PURE_USER" "postgres"+ password <- getEnvDef "PURE_PASSWORD" ""+ database <- getEnvDef "PURE_DATABASE" "postgres"+ let+ config =+ def+ { address = AddressNotResolved host port+ , user+ , password+ , database+ }+ connect config+ )+ $ afterAll+ disconnect+ $ do+ describe "CREATE TABLE/DROP TABLE" $ do+ it "prepare/execute" $ \conn -> do+ statement <- prepare conn "CREATE TABLE test (value INT NOT NULL)"+ n <- execute statement []+ n `shouldBe` 0+ statement <- prepare conn "DROP TABLE IF EXISTS test"+ n <- execute statement []+ n `shouldBe` 0+ commit conn+ pure ()++ it "run" $ \conn -> do+ run conn "CREATE TABLE test (value INT NOT NULL)" [] `shouldReturn` 0+ run conn "DROP TABLE IF EXISTS test" [] `shouldReturn` 0+ commit conn++ it "runRaw" $ \conn -> do+ let+ query =+ "CREATE TABLE test (value INT NOT NULL);\+ \DROP TABLE IF EXISTS test"+ runRaw conn query+ commit conn++ beforeWith+ ( \conn -> do+ let+ query =+ "CREATE TABLE test (value INT NOT NULL);\+ \INSERT INTO test (value) VALUES (0), (1), (2)"+ runRaw conn query+ commit conn+ pure conn+ )+ $ after+ ( \conn -> do+ void $ try @IO @SqlError $ do+ runRaw conn "DROP TABLE IF EXISTS test"+ commit conn+ )+ $ do+ describe "table: test (value INT NOT NULL)" $ do+ it "DELETE FROM test WHERE value = 0" $ \conn -> do+ run conn "DELETE FROM test WHERE value = 0" [] `shouldReturn` 1+ commit conn++ it "UPDATE test SET value = 10 WHERE value = 1" $ \conn -> do+ run conn "UPDATE test SET value = 10 WHERE value = 1" [] `shouldReturn` 1+ commit conn++ it "SELECT value FROM test ORDER BY value (reuse portal)" $ \conn -> do+ s <- prepare conn "SELECT value FROM test ORDER BY value"+ executeRaw s+ fetchRow s `shouldReturn` Just [SqlInt32 0]+ fetchRow s `shouldReturn` Just [SqlInt32 1]+ fetchRow s `shouldReturn` Just [SqlInt32 2]+ fetchRow s `shouldReturn` Nothing+ finish s++ it "SELECT value FROM test WHERE value = $1 (reuse prepared statement)" $ \conn -> do+ s <- prepare conn "SELECT value FROM test WHERE value = ?"+ void $ execute s [SqlInt32 0]+ fetchRow s `shouldReturn` Just [SqlInt32 0]+ void $ execute s [SqlInt32 1]+ fetchRow s `shouldReturn` Just [SqlInt32 1]+ void $ execute s [SqlInt32 2]+ fetchRow s `shouldReturn` Just [SqlInt32 2]+ finish s++ it "BEGIN/ROLLBACK" $ \conn -> do+ begin conn+ rollback conn++ it "BEGIN/COMMIT" $ \conn -> do+ begin conn+ commit conn++getEnvDef :: String -> String -> IO String+getEnvDef name value = fromMaybe value <$> lookupEnv name
+ test-original/Database/PostgreSQL/Pure/ListSpec.hs view
@@ -0,0 +1,313 @@+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE DuplicateRecordFields #-}+{-# LANGUAGE NamedFieldPuns #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE TypeApplications #-}++module Database.PostgreSQL.Pure.ListSpec (spec) where++import Database.PostgreSQL.Pure.List+import qualified Database.PostgreSQL.Pure.Oid as Oid++import Test.Hspec+import Test.Hspec.Core.Hooks.Extra++import Control.Monad (void)+import qualified Data.Attoparsec.ByteString as AP+import qualified Data.Attoparsec.ByteString.Char8 as AP+import qualified Data.ByteString as BS+import qualified Data.ByteString.Char8 as BSC+import qualified Data.ByteString.UTF8 as BSU+import Data.Default.Class (Default (def))+import Data.Int (Int32)+import Data.Maybe (fromMaybe)+import Data.Tuple.Only (Only (Only))+import qualified Network.Socket as NS+import System.Environment (lookupEnv)+import Text.Read (readMaybe)++{-# ANN module ("HLint: ignore Redundant do" :: String) #-}+{-# ANN module ("HLint: ignore Reduce duplication" :: String) #-}++data Env =+ Env+ { hostString :: String+ , portString :: String+ , host :: Maybe NS.HostAddress+ , port :: Maybe NS.PortNumber+ , user :: String+ , password :: String+ , database :: String+ }++spec :: Spec+spec = do+ beforeAll+ ( do+ hostString <- getEnvDef "PURE_HOST" "127.0.0.1"+ portString <- getEnvDef "PURE_PORT" "5432"+ let+ host = fromEitherToMaybe $ parseHostIPv4 $ BSC.pack hostString+ port = readMaybe portString :: Maybe NS.PortNumber+ user <- getEnvDef "PURE_USER" "postgres"+ password <- getEnvDef "PURE_PASSWORD" ""+ database <- getEnvDef "PURE_DATABASE" "postgres"+ pure Env { hostString, portString, host, port, user, password, database }+ )+ $ do+ describe "connection" $ do+ describe "connect/disconnect" $ do+ it "resolved address" $ \Env { host, port, user, password, database } -> do+ case (host, port) of+ (Just host, Just port) -> do+ let+ config =+ def+ { address = AddressResolved $ NS.SockAddrInet port host+ , user+ , password+ , database+ }+ conn <- connect config+ disconnect conn+ _ -> pendingWith "the given host and port are not resolved"++ it "not-resolved address" $ \Env { hostString, portString, user, password, database } -> do+ let+ config =+ def+ { address = AddressNotResolved hostString portString+ , user+ , password+ , database+ }+ conn <- connect config+ disconnect conn++ it "withConnection" $ \Env { hostString, portString, user, password, database } -> do+ let+ config =+ def+ { address = AddressNotResolved hostString portString+ , user+ , password+ , database+ }+ withConnection config (const $ pure ())++ beforeAllWith+ ( \Env { hostString, portString, user, password, database } -> do+ let+ config =+ def+ { address = AddressNotResolved hostString portString+ , user+ , password+ , database+ }+ connect config+ )+ $ afterAll+ disconnect+ $ do+ describe "CREATE TABLE/DROP TABLE" $ do+ it "hints, hints" $ \conn -> do+ let+ e0 = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "CREATE TABLE test (value INT NOT NULL)" (Right ([], []))+ e1 = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "DROP TABLE IF EXISTS test" (Right ([], []))+ (((_, _, e0, _), (_, _, e1, _)), ts) <- sync conn (e0, e1)+ ts `shouldBe` Idle+ result e0 `shouldBe` ExecuteComplete CreateTableTag+ records e0 `shouldBe` ([] :: [()])+ result e1 `shouldBe` ExecuteComplete DropTableTag+ records e1 `shouldBe` ([] :: [()])++ it "no hints, no hints" $ \conn -> do+ let+ e0 = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "CREATE TABLE test (value INT NOT NULL)" (Left (0, 0))+ e1 = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "DROP TABLE IF EXISTS test" (Left (0, 0))+ (((_, _, e0, _), (_, _, e1, _)), ts) <- sync conn (e0, e1)+ ts `shouldBe` Idle+ result e0 `shouldBe` ExecuteComplete CreateTableTag+ records e0 `shouldBe` ([] :: [()])+ result e1 `shouldBe` ExecuteComplete DropTableTag+ records e1 `shouldBe` ([] :: [()])++ beforeWith+ ( \conn -> do+ let+ e0 = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "CREATE TABLE test (value INT NOT NULL)" (Right ([], []))+ e1 = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "INSERT INTO test (value) VALUES (0), (1), (2)" (Right ([], []))+ (((_, _, e0, _), (_, _, e1, _)), ts) <- sync conn (e0, e1)+ ts `shouldBe` Idle+ result e0 `shouldBe` ExecuteComplete CreateTableTag+ records e0 `shouldBe` ([] :: [()])+ result e1 `shouldSatisfy` \(ExecuteComplete (InsertTag _ 3)) -> True+ records e1 `shouldBe` ([] :: [()])+ pure conn+ )+ $ after+ ( \conn -> do+ let+ e = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "DROP TABLE IF EXISTS test" (Right ([], []))+ ((_, _, e, _), ts) <- sync conn e+ ts `shouldBe` Idle+ result e `shouldBe` ExecuteComplete DropTableTag+ records e `shouldBe` ([] :: [()])+ )+ $ do+ describe "table: test (value INT NOT NULL)" $ do+ it "DELETE FROM test WHERE value = 0" $ \conn -> do+ let+ e = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "DELETE FROM test WHERE value = 0" (Right ([], []))+ ((_, _, e, _), ts) <- sync conn e+ ts `shouldBe` Idle+ result e `shouldBe` ExecuteComplete (DeleteTag 1)+ records e `shouldBe` ([] :: [()])++ it "UPDATE test SET value = 10 WHERE value = 1" $ \conn -> do+ let+ e = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "UPDATE test SET value = 10 WHERE value = 1" (Right ([], []))+ ((_, _, e, _), ts) <- sync conn e+ ts `shouldBe` Idle+ result e `shouldBe` ExecuteComplete (UpdateTag 1)+ records e `shouldBe` ([] :: [()])++ it "SELECT value FROM test ORDER BY value (get all)" $ \conn -> do+ let+ e = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "SELECT value FROM test ORDER BY value" (Right ([], [Oid.int4]))+ ((_, _, e, _), ts) <- sync conn e+ ts `shouldBe` Idle+ result e `shouldBe` ExecuteComplete (SelectTag 3)+ records e `shouldBe` ([Only 0, Only 1, Only 2] :: [Only Int])++ it "SELECT value FROM test ORDER BY value (get a part)" $ \conn -> do+ let+ e = execute 1 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "SELECT value FROM test ORDER BY value" (Right ([], [Oid.int4]))+ ((_, _, e, _), ts) <- sync conn e+ ts `shouldBe` Idle+ result e `shouldBe` ExecuteSuspended+ records e `shouldBe` ([Only 0] :: [Only Int])++ it "SELECT value FROM test ORDER BY value (reuse portal)" $ \conn -> do+ let+ p = forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "SELECT value FROM test ORDER BY value" (Right ([], [Oid.int4]))+ e = execute 2 (pure . BSU.toString) p+ (_, p, e, _) <- flush conn e+ result e `shouldBe` ExecuteSuspended+ records e `shouldBe` ([Only 0, Only 1] :: [Only Int])+ let+ e = execute 1 (pure . BSU.toString) p+ (_, _, e, _) <- flush conn e+ result e `shouldBe` ExecuteSuspended+ records e `shouldBe` ([Only 2] :: [Only Int])+ let+ e = execute 1 (pure . BSU.toString) p+ ((_, _, e, _), ts) <- sync conn e+ ts `shouldBe` Idle+ result e `shouldBe` ExecuteComplete (SelectTag 0)+ records e `shouldBe` ([] :: [Only Int])++ it "SELECT value FROM test WHERE value = $1 (reuse prepared statement)" $ \conn -> do+ let+ ps = parse "" "SELECT value FROM test WHERE value = $1" (Right ([Oid.int4], [Oid.int4]))+ e = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) (Only (0 :: Int32)) ps+ ((ps, _, e, _), ts) <- sync conn e+ ts `shouldBe` Idle+ result e `shouldBe` ExecuteComplete (SelectTag 1)+ records e `shouldBe` [Only (0 :: Int)]+ let+ e = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) (Only (2 :: Int32)) ps+ ((_, _, e, _), ts) <- sync conn e+ ts `shouldBe` Idle+ result e `shouldBe` ExecuteComplete (SelectTag 1)+ records e `shouldBe` [Only (2 :: Int)]++ it "BEGIN/ROLLBACK" $ \conn -> do+ ((_, _, e, _), ts) <- sync conn begin+ ts `shouldBe` Block+ result e `shouldBe` ExecuteComplete BeginTag+ records e `shouldBe` []+ ((_, _, e, _), ts) <- sync conn rollback+ ts `shouldBe` Idle+ result e `shouldBe` ExecuteComplete RollbackTag+ records e `shouldBe` []++ it "BEGIN/COMMIT" $ \conn -> do+ ((_, _, e, _), ts) <- sync conn begin+ ts `shouldBe` Block+ result e `shouldBe` ExecuteComplete BeginTag+ records e `shouldBe` []+ ((_, _, e, _), ts) <- sync conn commit+ ts `shouldBe` Idle+ result e `shouldBe` ExecuteComplete CommitTag+ records e `shouldBe` []++ describe "invalid SQL" $ do+ it "parse sync" $ \conn -> do+ let+ ps = parse "" "INVALID SQL" (Right ([], []))+ sync conn ps `shouldThrow` (\ErrorResponse {} -> True)++ it "parse flush" $ \conn -> do+ let+ ps = parse "" "INVALID SQL" (Right ([], []))+ flush conn ps `shouldThrow` (\ErrorResponse {} -> True)++ describe "invalid parameter type" $ do+ it "parse sync" $ \conn -> do+ let+ ps = parse "" "SELECT value FROM test WHERE value = $1" (Right ([Oid.varchar], [Oid.int4]))+ void $ sync conn ps `shouldThrow` (\ErrorResponse {} -> True)++ it "parse flush" $ \conn -> do+ let+ ps = parse "" "SELECT value FROM test WHERE value = $1" (Right ([Oid.varchar], [Oid.int4]))+ void $ flush conn ps `shouldThrow` (\ErrorResponse {} -> True)++ describe "invalid result type" $ do+ it "parse/bind sync" $ \conn -> do+ let+ p = forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "SELECT value FROM test ORDER BY value LIMIT 1" (Right ([], [Oid.varchar]))+ ((_, _), ts) <- sync conn p+ ts `shouldBe` Idle++ it "parse/bind flush" $ \conn -> do+ let+ p = forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "SELECT value FROM test ORDER BY value LIMIT 1" (Right ([], [Oid.varchar]))+ void $ flush conn p++ it "parse/bind/execute sync" $ \conn -> do+ let+ e = execute @_ @(Only Int) 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "SELECT value FROM test ORDER BY value LIMIT 1" (Right ([], [Oid.varchar]))+ sync conn e `shouldThrow` (\ResponseParsingFailed {} -> True)++ it "parse/bind/execute flush" $ \conn -> do+ let+ e = execute @_ @(Only Int) 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "SELECT value FROM test ORDER BY value LIMIT 1" (Right ([], [Oid.varchar]))+ flush conn e `shouldThrow` (\ResponseParsingFailed {} -> True)++getEnvDef :: String -> String -> IO String+getEnvDef name value = fromMaybe value <$> lookupEnv name++parseHostIPv4 :: BS.ByteString -> Either String NS.HostAddress+parseHostIPv4 =+ AP.parseOnly ipv4Parser+ where+ ipv4Parser = do+ p1 <- AP.decimal+ void $ AP.char '.'+ p2 <- AP.decimal+ void $ AP.char '.'+ p3 <- AP.decimal+ void $ AP.char '.'+ p4 <- AP.decimal+ pure $ NS.tupleToHostAddress (p1, p2, p3, p4)++fromEitherToMaybe :: Either a b -> Maybe b+fromEitherToMaybe (Left _) = Nothing+fromEitherToMaybe (Right b) = Just b++forceRight :: Either String a -> a+forceRight (Right a) = a+forceRight (Left e) = error $ "forceRight: " <> e
+ test-original/Database/PostgreSQL/PureSpec.hs view
@@ -0,0 +1,314 @@+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE DuplicateRecordFields #-}+{-# LANGUAGE NamedFieldPuns #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE TypeApplications #-}++module Database.PostgreSQL.PureSpec (spec) where++import Database.PostgreSQL.Pure+import qualified Database.PostgreSQL.Pure.Oid as Oid++import Test.Hspec+import Test.Hspec.Core.Hooks.Extra++import Control.Monad (void)+import qualified Data.Attoparsec.ByteString as AP+import qualified Data.Attoparsec.ByteString.Char8 as AP+import qualified Data.ByteString as BS+import qualified Data.ByteString.Char8 as BSC+import qualified Data.ByteString.UTF8 as BSU+import Data.Default.Class (Default (def))+import Data.Int (Int32)+import Data.Maybe (fromMaybe)+import qualified Data.Tuple.Homotuple as T+import Data.Tuple.Homotuple.Only ()+import Data.Tuple.Only (Only (Only))+import qualified Network.Socket as NS+import System.Environment (lookupEnv)+import Text.Read (readMaybe)++{-# ANN module ("HLint: ignore Redundant do" :: String) #-}++data Env =+ Env+ { hostString :: String+ , portString :: String+ , host :: Maybe NS.HostAddress+ , port :: Maybe NS.PortNumber+ , user :: String+ , password :: String+ , database :: String+ }++spec :: Spec+spec = do+ beforeAll+ ( do+ hostString <- getEnvDef "PURE_HOST" "127.0.0.1"+ portString <- getEnvDef "PURE_PORT" "5432"+ let+ host = fromEitherToMaybe $ parseHostIPv4 $ BSC.pack hostString+ port = readMaybe portString :: Maybe NS.PortNumber+ user <- getEnvDef "PURE_USER" "postgres"+ password <- getEnvDef "PURE_PASSWORD" ""+ database <- getEnvDef "PURE_DATABASE" "postgres"+ pure Env { hostString, portString, host, port, user, password, database }+ )+ $ do+ describe "connection" $ do+ describe "connect/disconnect" $ do+ it "resolved address" $ \Env { host, port, user, password, database } -> do+ case (host, port) of+ (Just host, Just port) -> do+ let+ config =+ def+ { address = AddressResolved $ NS.SockAddrInet port host+ , user+ , password+ , database+ }+ conn <- connect config+ disconnect conn+ _ -> pendingWith "the given host and port are not resolved"++ it "not-resolved address" $ \Env { hostString, portString, user, password, database } -> do+ let+ config =+ def+ { address = AddressNotResolved hostString portString+ , user+ , password+ , database+ }+ conn <- connect config+ disconnect conn++ it "withConnection" $ \Env { hostString, portString, user, password, database } -> do+ let+ config =+ def+ { address = AddressNotResolved hostString portString+ , user+ , password+ , database+ }+ withConnection config (const $ pure ())++ beforeAllWith+ ( \Env { hostString, portString, user, password, database } -> do+ let+ config =+ def+ { address = AddressNotResolved hostString portString+ , user+ , password+ , database+ }+ connect config+ )+ $ afterAll+ disconnect+ $ do+ describe "CREATE TABLE/DROP TABLE" $ do+ it "hints, hints" $ \conn -> do+ let+ e0 = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "CREATE TABLE test (value INT NOT NULL)" (Just (T.Empty, T.Empty))+ e1 = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "DROP TABLE IF EXISTS test" (Just (T.Empty, T.Empty))+ (((_, _, e0, _), (_, _, e1, _)), ts) <- sync conn (e0, e1)+ ts `shouldBe` Idle+ result e0 `shouldBe` ExecuteComplete CreateTableTag+ records e0 `shouldBe` ([] :: [()])+ result e1 `shouldBe` ExecuteComplete DropTableTag+ records e1 `shouldBe` ([] :: [()])++ it "no hints, no hints" $ \conn -> do+ let+ e0 = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "CREATE TABLE test (value INT NOT NULL)" Nothing+ e1 = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "DROP TABLE IF EXISTS test" Nothing+ (((_, _, e0, _), (_, _, e1, _)), ts) <- sync conn (e0, e1)+ ts `shouldBe` Idle+ result e0 `shouldBe` ExecuteComplete CreateTableTag+ records e0 `shouldBe` ([] :: [()])+ result e1 `shouldBe` ExecuteComplete DropTableTag+ records e1 `shouldBe` ([] :: [()])++ beforeWith+ ( \conn -> do+ let+ e0 = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "CREATE TABLE test (value INT NOT NULL)" (Just (T.Empty, T.Empty))+ e1 = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "INSERT INTO test (value) VALUES (0), (1), (2)" (Just (T.Empty, T.Empty))+ (((_, _, e0, _), (_, _, e1, _)), ts) <- sync conn (e0, e1)+ ts `shouldBe` Idle+ result e0 `shouldBe` ExecuteComplete CreateTableTag+ records e0 `shouldBe` ([] :: [()])+ result e1 `shouldSatisfy` \(ExecuteComplete (InsertTag _ 3)) -> True+ records e1 `shouldBe` ([] :: [()])+ pure conn+ )+ $ after+ ( \conn -> do+ let+ e = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "DROP TABLE IF EXISTS test" (Just (T.Empty, T.Empty))+ ((_, _, e, _), ts) <- sync conn e+ ts `shouldBe` Idle+ result e `shouldBe` ExecuteComplete DropTableTag+ records e `shouldBe` ([] :: [()])+ )+ $ do+ describe "table: test (value INT NOT NULL)" $ do+ it "DELETE FROM test WHERE value = 0" $ \conn -> do+ let+ e = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "DELETE FROM test WHERE value = 0" (Just (T.Empty, T.Empty))+ ((_, _, e, _), ts) <- sync conn e+ ts `shouldBe` Idle+ result e `shouldBe` ExecuteComplete (DeleteTag 1)+ records e `shouldBe` ([] :: [()])++ it "UPDATE test SET value = 10 WHERE value = 1" $ \conn -> do+ let+ e = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "UPDATE test SET value = 10 WHERE value = 1" (Just (T.Empty, T.Empty))+ ((_, _, e, _), ts) <- sync conn e+ ts `shouldBe` Idle+ result e `shouldBe` ExecuteComplete (UpdateTag 1)+ records e `shouldBe` ([] :: [()])++ it "SELECT value FROM test ORDER BY value (get all)" $ \conn -> do+ let+ e = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "SELECT value FROM test ORDER BY value" (Just (T.Empty, Only Oid.int4))+ ((_, _, e, _), ts) <- sync conn e+ ts `shouldBe` Idle+ result e `shouldBe` ExecuteComplete (SelectTag 3)+ records e `shouldBe` ([Only 0, Only 1, Only 2] :: [Only Int])++ it "SELECT value FROM test ORDER BY value (get a part)" $ \conn -> do+ let+ e = execute 1 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "SELECT value FROM test ORDER BY value" (Just (T.Empty, Only Oid.int4))+ ((_, _, e, _), ts) <- sync conn e+ ts `shouldBe` Idle+ result e `shouldBe` ExecuteSuspended+ records e `shouldBe` ([Only 0] :: [Only Int])++ it "SELECT value FROM test ORDER BY value (reuse portal)" $ \conn -> do+ let+ p = forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "SELECT value FROM test ORDER BY value" (Just (T.Empty, Only Oid.int4))+ e = execute 2 (pure . BSU.toString) p+ (_, p, e, _) <- flush conn e+ result e `shouldBe` ExecuteSuspended+ records e `shouldBe` ([Only 0, Only 1] :: [Only Int])+ let+ e = execute 1 (pure . BSU.toString) p+ (_, _, e, _) <- flush conn e+ result e `shouldBe` ExecuteSuspended+ records e `shouldBe` ([Only 2] :: [Only Int])+ let+ e = execute 1 (pure . BSU.toString) p+ ((_, _, e, _), ts) <- sync conn e+ ts `shouldBe` Idle+ result e `shouldBe` ExecuteComplete (SelectTag 0)+ records e `shouldBe` ([] :: [Only Int])++ it "SELECT value FROM test WHERE value = $1 (reuse prepared statement)" $ \conn -> do+ let+ ps = parse "" "SELECT value FROM test WHERE value = $1" (Just (Only Oid.int4, Only Oid.int4))+ e = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) (Only (0 :: Int32)) ps+ ((ps, _, e, _), ts) <- sync conn e+ ts `shouldBe` Idle+ result e `shouldBe` ExecuteComplete (SelectTag 1)+ records e `shouldBe` [Only (0 :: Int)]+ let+ e = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) (Only (2 :: Int32)) ps+ ((_, _, e, _), ts) <- sync conn e+ ts `shouldBe` Idle+ result e `shouldBe` ExecuteComplete (SelectTag 1)+ records e `shouldBe` [Only (2 :: Int)]++ it "BEGIN/ROLLBACK" $ \conn -> do+ ((_, _, e, _), ts) <- sync conn begin+ ts `shouldBe` Block+ result e `shouldBe` ExecuteComplete BeginTag+ records e `shouldBe` []+ ((_, _, e, _), ts) <- sync conn rollback+ ts `shouldBe` Idle+ result e `shouldBe` ExecuteComplete RollbackTag+ records e `shouldBe` []++ it "BEGIN/COMMIT" $ \conn -> do+ ((_, _, e, _), ts) <- sync conn begin+ ts `shouldBe` Block+ result e `shouldBe` ExecuteComplete BeginTag+ records e `shouldBe` []+ ((_, _, e, _), ts) <- sync conn commit+ ts `shouldBe` Idle+ result e `shouldBe` ExecuteComplete CommitTag+ records e `shouldBe` []++ describe "invalid SQL" $ do+ it "parse sync" $ \conn -> do+ let+ ps = parse "" "INVALID SQL" (Just (T.Empty, T.Empty))+ sync conn ps `shouldThrow` (\ErrorResponse {} -> True)++ it "parse flush" $ \conn -> do+ let+ ps = parse "" "INVALID SQL" (Just (T.Empty, T.Empty))+ flush conn ps `shouldThrow` (\ErrorResponse {} -> True)++ describe "invalid parameter type" $ do+ it "parse sync" $ \conn -> do+ let+ ps = parse "" "SELECT value FROM test WHERE value = $1" (Just (Only Oid.varchar, Only Oid.int4))+ void $ sync conn ps `shouldThrow` (\ErrorResponse {} -> True)++ it "parse flush" $ \conn -> do+ let+ ps = parse "" "SELECT value FROM test WHERE value = $1" (Just (Only Oid.varchar, Only Oid.int4))+ void $ flush conn ps `shouldThrow` (\ErrorResponse {} -> True)++ describe "invalid result type" $ do+ it "parse/bind sync" $ \conn -> do+ let+ p = forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "SELECT value FROM test ORDER BY value LIMIT 1" (Just (T.Empty, Only Oid.varchar))+ ((_, _), ts) <- sync conn p+ ts `shouldBe` Idle++ it "parse/bind flush" $ \conn -> do+ let+ p = forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "SELECT value FROM test ORDER BY value LIMIT 1" (Just (T.Empty, Only Oid.varchar))+ void $ flush conn p++ it "parse/bind/execute sync" $ \conn -> do+ let+ e = execute @_ @_ @(Only Int) 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "SELECT value FROM test ORDER BY value LIMIT 1" (Just (T.Empty, Only Oid.varchar))+ sync conn e `shouldThrow` (\ResponseParsingFailed {} -> True)++ it "parse/bind/execute flush" $ \conn -> do+ let+ e = execute @_ @_ @(Only Int) 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "SELECT value FROM test ORDER BY value LIMIT 1" (Just (T.Empty, Only Oid.varchar))+ flush conn e `shouldThrow` (\ResponseParsingFailed {} -> True)++getEnvDef :: String -> String -> IO String+getEnvDef name value = fromMaybe value <$> lookupEnv name++parseHostIPv4 :: BS.ByteString -> Either String NS.HostAddress+parseHostIPv4 =+ AP.parseOnly ipv4Parser+ where+ ipv4Parser = do+ p1 <- AP.decimal+ void $ AP.char '.'+ p2 <- AP.decimal+ void $ AP.char '.'+ p3 <- AP.decimal+ void $ AP.char '.'+ p4 <- AP.decimal+ pure $ NS.tupleToHostAddress (p1, p2, p3, p4)++fromEitherToMaybe :: Either a b -> Maybe b+fromEitherToMaybe (Left _) = Nothing+fromEitherToMaybe (Right b) = Just b++forceRight :: Either String a -> a+forceRight (Right a) = a+forceRight (Left e) = error $ "forceRight: " <> e
+ test-original/Spec.hs view
@@ -0,0 +1,1 @@+{-# OPTIONS_GHC -F -pgmF hspec-discover #-}
+ test-original/Test/Hspec/Core/Hooks/Extra.hs view
@@ -0,0 +1,30 @@+module Test.Hspec.Core.Hooks.Extra+ ( beforeAllWith+ ) where++import Test.Hspec.Core.Hooks+import Test.Hspec.Core.Spec++import Control.Concurrent.MVar (MVar, modifyMVar, newMVar)+import Control.Exception (SomeException, throwIO, try)++data Memoized a =+ Empty+ | Memoized a+ | Failed SomeException++memoize :: MVar (Memoized a) -> IO a -> IO a+memoize mvar action = do+ result <- modifyMVar mvar $ \ma -> case ma of+ Empty -> do+ a <- try action+ return (either Failed Memoized a, a)+ Memoized a -> return (ma, Right a)+ Failed _ -> throwIO (Pending Nothing (Just "exception in beforeAll-hook (see previous failure)"))+ either throwIO return result++-- | Run a custom action befor the first spec item.+beforeAllWith :: (b -> IO a) -> SpecWith a -> SpecWith b+beforeAllWith action spec = do+ mver <- runIO (newMVar Empty)+ beforeWith (memoize mver . action) spec
test-relational-record/DataSource.hs view
@@ -1,7 +1,17 @@ module DataSource (connect) where -import Data.Default.Class (def)+import Data.Maybe (fromMaybe) import Database.HDBC.PostgreSQL (Connection, connectPostgreSQL)+import System.Environment (lookupEnv) connect :: IO Connection-connect = connectPostgreSQL "host='localhost' user='postgres'"+connect = do+ host <- getEnvDef "PURE_HOST" "127.0.0.1"+ port <- getEnvDef "PURE_PORT" "5432"+ user <- getEnvDef "PURE_USER" "postgres"+ password <- getEnvDef "PURE_PASSWORD" ""+ database <- getEnvDef "PURE_DATABASE" "postgres"+ connectPostgreSQL $ "host='" ++ host ++ "' port='" ++ port ++ "'user='" ++ user ++"' password = '" ++ password ++ "' dbname = '" ++ database ++ "'"++getEnvDef :: String -> String -> IO String+getEnvDef name value = fromMaybe value <$> lookupEnv name
test-relational-record/DataSource/Pure.hs view
@@ -1,7 +1,28 @@+{-# LANGUAGE NamedFieldPuns #-}+ module DataSource.Pure (connect) where import Data.Default.Class (def)+import Data.Maybe (fromMaybe) import qualified Database.HDBC.PostgreSQL.Pure as Pure+import System.Environment (lookupEnv) connect :: IO Pure.Connection-connect = Pure.connect def+connect = do+ host <- getEnvDef "PURE_HOST" "127.0.0.1"+ port <- getEnvDef "PURE_PORT" "5432"+ user <- getEnvDef "PURE_USER" "postgres"+ password <- getEnvDef "PURE_PASSWORD" ""+ database <- getEnvDef "PURE_DATABASE" "postgres"+ let+ config =+ def+ { Pure.address = Pure.AddressNotResolved host port+ , Pure.user+ , Pure.password+ , Pure.database+ }+ Pure.connect config++getEnvDef :: String -> String -> IO String+getEnvDef name value = fromMaybe value <$> lookupEnv name
− test/Database/HDBC/PostgreSQL/PureSpec.hs
@@ -1,120 +0,0 @@-{-# LANGUAGE NamedFieldPuns #-}-{-# LANGUAGE TypeApplications #-}--module Database.HDBC.PostgreSQL.PureSpec (spec) where--import Database.HDBC-import Database.HDBC.PostgreSQL.Pure--import Test.Hspec--import Control.Exception.Safe (try)-import Control.Monad (void)-import Data.Default.Class (Default (def))-import Data.Maybe (fromMaybe)-import System.Environment (lookupEnv)--{-# ANN module ("HLint: ignore Redundant do" :: String) #-}-{-# ANN module ("HLint: ignore Reduce duplication" :: String) #-}--spec :: Spec-spec = do- beforeAll- ( do- hostString <- getEnvDef "PURE_HOST" "127.0.0.1"- portString <- getEnvDef "PURE_PORT" "5432"- user <- getEnvDef "PURE_USER" "postgres"- password <- getEnvDef "PURE_PASSWORD" ""- database <- getEnvDef "PURE_DATABASE" "postgres"- let- config =- def- { address = AddressNotResolved hostString portString- , user- , password- , database- }- connect config- )- $ afterAll- disconnect- $ do- describe "CREATE TABLE/DROP TABLE" $ do- it "prepare/execute" $ \conn -> do- statement <- prepare conn "CREATE TABLE test (value INT NOT NULL)"- n <- execute statement []- n `shouldBe` 0- statement <- prepare conn "DROP TABLE IF EXISTS test"- n <- execute statement []- n `shouldBe` 0- commit conn- pure ()-- it "run" $ \conn -> do- run conn "CREATE TABLE test (value INT NOT NULL)" [] `shouldReturn` 0- run conn "DROP TABLE IF EXISTS test" [] `shouldReturn` 0- commit conn-- it "runRaw" $ \conn -> do- let- query =- "CREATE TABLE test (value INT NOT NULL);\- \DROP TABLE IF EXISTS test"- runRaw conn query- commit conn-- beforeWith- ( \conn -> do- let- query =- "CREATE TABLE test (value INT NOT NULL);\- \INSERT INTO test (value) VALUES (0), (1), (2)"- runRaw conn query- commit conn- pure conn- )- $ after- ( \conn -> do- void $ try @IO @SqlError $ do- runRaw conn "DROP TABLE IF EXISTS test"- commit conn- )- $ do- describe "table: test (value INT NOT NULL)" $ do- it "DELETE FROM test WHERE value = 0" $ \conn -> do- run conn "DELETE FROM test WHERE value = 0" [] `shouldReturn` 1- commit conn-- it "UPDATE test SET value = 10 WHERE value = 1" $ \conn -> do- run conn "UPDATE test SET value = 10 WHERE value = 1" [] `shouldReturn` 1- commit conn-- it "SELECT value FROM test ORDER BY value (reuse portal)" $ \conn -> do- s <- prepare conn "SELECT value FROM test ORDER BY value"- executeRaw s- fetchRow s `shouldReturn` Just [SqlInt32 0]- fetchRow s `shouldReturn` Just [SqlInt32 1]- fetchRow s `shouldReturn` Just [SqlInt32 2]- fetchRow s `shouldReturn` Nothing- finish s-- it "SELECT value FROM test WHERE value = $1 (reuse prepared statement)" $ \conn -> do- s <- prepare conn "SELECT value FROM test WHERE value = ?"- void $ execute s [SqlInt32 0]- fetchRow s `shouldReturn` Just [SqlInt32 0]- void $ execute s [SqlInt32 1]- fetchRow s `shouldReturn` Just [SqlInt32 1]- void $ execute s [SqlInt32 2]- fetchRow s `shouldReturn` Just [SqlInt32 2]- finish s-- it "BEGIN/ROLLBACK" $ \conn -> do- begin conn- rollback conn-- it "BEGIN/COMMIT" $ \conn -> do- begin conn- commit conn--getEnvDef :: String -> String -> IO String-getEnvDef name value = fromMaybe value <$> lookupEnv name
− test/Database/PostgreSQL/Pure/ListSpec.hs
@@ -1,313 +0,0 @@-{-# LANGUAGE DataKinds #-}-{-# LANGUAGE DuplicateRecordFields #-}-{-# LANGUAGE NamedFieldPuns #-}-{-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE TypeApplications #-}--module Database.PostgreSQL.Pure.ListSpec (spec) where--import Database.PostgreSQL.Pure.List-import qualified Database.PostgreSQL.Pure.Oid as Oid--import Test.Hspec-import Test.Hspec.Core.Hooks.Extra--import Control.Monad (void)-import qualified Data.Attoparsec.ByteString as AP-import qualified Data.Attoparsec.ByteString.Char8 as AP-import qualified Data.ByteString as BS-import qualified Data.ByteString.Char8 as BSC-import qualified Data.ByteString.UTF8 as BSU-import Data.Default.Class (Default (def))-import Data.Int (Int32)-import Data.Maybe (fromMaybe)-import Data.Tuple.Only (Only (Only))-import qualified Network.Socket as NS-import System.Environment (lookupEnv)-import Text.Read (readMaybe)--{-# ANN module ("HLint: ignore Redundant do" :: String) #-}-{-# ANN module ("HLint: ignore Reduce duplication" :: String) #-}--data Env =- Env- { hostString :: String- , portString :: String- , host :: Maybe NS.HostAddress- , port :: Maybe NS.PortNumber- , user :: String- , password :: String- , database :: String- }--spec :: Spec-spec = do- beforeAll- ( do- hostString <- getEnvDef "PURE_HOST" "127.0.0.1"- portString <- getEnvDef "PURE_PORT" "5432"- let- host = fromEitherToMaybe $ parseHostIPv4 $ BSC.pack hostString- port = readMaybe portString :: Maybe NS.PortNumber- user <- getEnvDef "PURE_USER" "postgres"- password <- getEnvDef "PURE_PASSWORD" ""- database <- getEnvDef "PURE_DATABASE" "postgres"- pure Env { hostString, portString, host, port, user, password, database }- )- $ do- describe "connection" $ do- describe "connect/disconnect" $ do- it "resolved address" $ \Env { host, port, user, password, database } -> do- case (host, port) of- (Just host, Just port) -> do- let- config =- def- { address = AddressResolved $ NS.SockAddrInet port host- , user- , password- , database- }- conn <- connect config- disconnect conn- _ -> pendingWith "the given host and port are not resolved"-- it "not-resolved address" $ \Env { hostString, portString, user, password, database } -> do- let- config =- def- { address = AddressNotResolved hostString portString- , user- , password- , database- }- conn <- connect config- disconnect conn-- it "withConnection" $ \Env { hostString, portString, user, password, database } -> do- let- config =- def- { address = AddressNotResolved hostString portString- , user- , password- , database- }- withConnection config (const $ pure ())-- beforeAllWith- ( \Env { hostString, portString, user, password, database } -> do- let- config =- def- { address = AddressNotResolved hostString portString- , user- , password- , database- }- connect config- )- $ afterAll- disconnect- $ do- describe "CREATE TABLE/DROP TABLE" $ do- it "hints, hints" $ \conn -> do- let- e0 = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "CREATE TABLE test (value INT NOT NULL)" (Right ([], []))- e1 = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "DROP TABLE IF EXISTS test" (Right ([], []))- (((_, _, e0, _), (_, _, e1, _)), ts) <- sync conn (e0, e1)- ts `shouldBe` Idle- result e0 `shouldBe` ExecuteComplete CreateTableTag- records e0 `shouldBe` ([] :: [()])- result e1 `shouldBe` ExecuteComplete DropTableTag- records e1 `shouldBe` ([] :: [()])-- it "no hints, no hints" $ \conn -> do- let- e0 = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "CREATE TABLE test (value INT NOT NULL)" (Left (0, 0))- e1 = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "DROP TABLE IF EXISTS test" (Left (0, 0))- (((_, _, e0, _), (_, _, e1, _)), ts) <- sync conn (e0, e1)- ts `shouldBe` Idle- result e0 `shouldBe` ExecuteComplete CreateTableTag- records e0 `shouldBe` ([] :: [()])- result e1 `shouldBe` ExecuteComplete DropTableTag- records e1 `shouldBe` ([] :: [()])-- beforeWith- ( \conn -> do- let- e0 = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "CREATE TABLE test (value INT NOT NULL)" (Right ([], []))- e1 = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "INSERT INTO test (value) VALUES (0), (1), (2)" (Right ([], []))- (((_, _, e0, _), (_, _, e1, _)), ts) <- sync conn (e0, e1)- ts `shouldBe` Idle- result e0 `shouldBe` ExecuteComplete CreateTableTag- records e0 `shouldBe` ([] :: [()])- result e1 `shouldSatisfy` \(ExecuteComplete (InsertTag _ 3)) -> True- records e1 `shouldBe` ([] :: [()])- pure conn- )- $ after- ( \conn -> do- let- e = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "DROP TABLE IF EXISTS test" (Right ([], []))- ((_, _, e, _), ts) <- sync conn e- ts `shouldBe` Idle- result e `shouldBe` ExecuteComplete DropTableTag- records e `shouldBe` ([] :: [()])- )- $ do- describe "table: test (value INT NOT NULL)" $ do- it "DELETE FROM test WHERE value = 0" $ \conn -> do- let- e = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "DELETE FROM test WHERE value = 0" (Right ([], []))- ((_, _, e, _), ts) <- sync conn e- ts `shouldBe` Idle- result e `shouldBe` ExecuteComplete (DeleteTag 1)- records e `shouldBe` ([] :: [()])-- it "UPDATE test SET value = 10 WHERE value = 1" $ \conn -> do- let- e = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "UPDATE test SET value = 10 WHERE value = 1" (Right ([], []))- ((_, _, e, _), ts) <- sync conn e- ts `shouldBe` Idle- result e `shouldBe` ExecuteComplete (UpdateTag 1)- records e `shouldBe` ([] :: [()])-- it "SELECT value FROM test ORDER BY value (get all)" $ \conn -> do- let- e = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "SELECT value FROM test ORDER BY value" (Right ([], [Oid.int4]))- ((_, _, e, _), ts) <- sync conn e- ts `shouldBe` Idle- result e `shouldBe` ExecuteComplete (SelectTag 3)- records e `shouldBe` ([Only 0, Only 1, Only 2] :: [Only Int])-- it "SELECT value FROM test ORDER BY value (get a part)" $ \conn -> do- let- e = execute 1 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "SELECT value FROM test ORDER BY value" (Right ([], [Oid.int4]))- ((_, _, e, _), ts) <- sync conn e- ts `shouldBe` Idle- result e `shouldBe` ExecuteSuspended- records e `shouldBe` ([Only 0] :: [Only Int])-- it "SELECT value FROM test ORDER BY value (reuse portal)" $ \conn -> do- let- p = forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "SELECT value FROM test ORDER BY value" (Right ([], [Oid.int4]))- e = execute 2 (pure . BSU.toString) p- (_, p, e, _) <- flush conn e- result e `shouldBe` ExecuteSuspended- records e `shouldBe` ([Only 0, Only 1] :: [Only Int])- let- e = execute 1 (pure . BSU.toString) p- (_, _, e, _) <- flush conn e- result e `shouldBe` ExecuteSuspended- records e `shouldBe` ([Only 2] :: [Only Int])- let- e = execute 1 (pure . BSU.toString) p- ((_, _, e, _), ts) <- sync conn e- ts `shouldBe` Idle- result e `shouldBe` ExecuteComplete (SelectTag 0)- records e `shouldBe` ([] :: [Only Int])-- it "SELECT value FROM test WHERE value = $1 (reuse prepared statement)" $ \conn -> do- let- ps = parse "" "SELECT value FROM test WHERE value = $1" (Right ([Oid.int4], [Oid.int4]))- e = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) (Only (0 :: Int32)) ps- ((ps, _, e, _), ts) <- sync conn e- ts `shouldBe` Idle- result e `shouldBe` ExecuteComplete (SelectTag 1)- records e `shouldBe` [Only (0 :: Int)]- let- e = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) (Only (2 :: Int32)) ps- ((_, _, e, _), ts) <- sync conn e- ts `shouldBe` Idle- result e `shouldBe` ExecuteComplete (SelectTag 1)- records e `shouldBe` [Only (2 :: Int)]-- it "BEGIN/ROLLBACK" $ \conn -> do- ((_, _, e, _), ts) <- sync conn begin- ts `shouldBe` Block- result e `shouldBe` ExecuteComplete BeginTag- records e `shouldBe` []- ((_, _, e, _), ts) <- sync conn rollback- ts `shouldBe` Idle- result e `shouldBe` ExecuteComplete RollbackTag- records e `shouldBe` []-- it "BEGIN/COMMIT" $ \conn -> do- ((_, _, e, _), ts) <- sync conn begin- ts `shouldBe` Block- result e `shouldBe` ExecuteComplete BeginTag- records e `shouldBe` []- ((_, _, e, _), ts) <- sync conn commit- ts `shouldBe` Idle- result e `shouldBe` ExecuteComplete CommitTag- records e `shouldBe` []-- describe "invalid SQL" $ do- it "parse sync" $ \conn -> do- let- ps = parse "" "INVALID SQL" (Right ([], []))- sync conn ps `shouldThrow` (\ErrorResponse {} -> True)-- it "parse flush" $ \conn -> do- let- ps = parse "" "INVALID SQL" (Right ([], []))- flush conn ps `shouldThrow` (\ErrorResponse {} -> True)-- describe "invalid parameter type" $ do- it "parse sync" $ \conn -> do- let- ps = parse "" "SELECT value FROM test WHERE value = $1" (Right ([Oid.varchar], [Oid.int4]))- void $ sync conn ps `shouldThrow` (\ErrorResponse {} -> True)-- it "parse flush" $ \conn -> do- let- ps = parse "" "SELECT value FROM test WHERE value = $1" (Right ([Oid.varchar], [Oid.int4]))- void $ flush conn ps `shouldThrow` (\ErrorResponse {} -> True)-- describe "invalid result type" $ do- it "parse/bind sync" $ \conn -> do- let- p = forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "SELECT value FROM test ORDER BY value LIMIT 1" (Right ([], [Oid.varchar]))- ((_, _), ts) <- sync conn p- ts `shouldBe` Idle-- it "parse/bind flush" $ \conn -> do- let- p = forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "SELECT value FROM test ORDER BY value LIMIT 1" (Right ([], [Oid.varchar]))- void $ flush conn p-- it "parse/bind/execute sync" $ \conn -> do- let- e = execute @_ @(Only Int) 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "SELECT value FROM test ORDER BY value LIMIT 1" (Right ([], [Oid.varchar]))- sync conn e `shouldThrow` (\ResponseParsingFailed {} -> True)-- it "parse/bind/execute flush" $ \conn -> do- let- e = execute @_ @(Only Int) 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "SELECT value FROM test ORDER BY value LIMIT 1" (Right ([], [Oid.varchar]))- flush conn e `shouldThrow` (\ResponseParsingFailed {} -> True)--getEnvDef :: String -> String -> IO String-getEnvDef name value = fromMaybe value <$> lookupEnv name--parseHostIPv4 :: BS.ByteString -> Either String NS.HostAddress-parseHostIPv4 =- AP.parseOnly ipv4Parser- where- ipv4Parser = do- p1 <- AP.decimal- void $ AP.char '.'- p2 <- AP.decimal- void $ AP.char '.'- p3 <- AP.decimal- void $ AP.char '.'- p4 <- AP.decimal- pure $ NS.tupleToHostAddress (p1, p2, p3, p4)--fromEitherToMaybe :: Either a b -> Maybe b-fromEitherToMaybe (Left _) = Nothing-fromEitherToMaybe (Right b) = Just b--forceRight :: Either String a -> a-forceRight (Right a) = a-forceRight (Left e) = error $ "forceRight: " <> e
− test/Database/PostgreSQL/PureSpec.hs
@@ -1,315 +0,0 @@-{-# LANGUAGE DataKinds #-}-{-# LANGUAGE DuplicateRecordFields #-}-{-# LANGUAGE NamedFieldPuns #-}-{-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE TypeApplications #-}--module Database.PostgreSQL.PureSpec (spec) where--import Database.PostgreSQL.Pure-import qualified Database.PostgreSQL.Pure.Oid as Oid--import Test.Hspec-import Test.Hspec.Core.Hooks.Extra--import Control.Monad (void)-import qualified Data.Attoparsec.ByteString as AP-import qualified Data.Attoparsec.ByteString.Char8 as AP-import qualified Data.ByteString as BS-import qualified Data.ByteString.Char8 as BSC-import qualified Data.ByteString.UTF8 as BSU-import Data.Default.Class (Default (def))-import Data.Int (Int32)-import Data.Maybe (fromMaybe)-import qualified Data.Tuple.Homotuple as T-import Data.Tuple.Homotuple.Only ()-import Data.Tuple.List.Only ()-import Data.Tuple.Only (Only (Only))-import qualified Network.Socket as NS-import System.Environment (lookupEnv)-import Text.Read (readMaybe)--{-# ANN module ("HLint: ignore Redundant do" :: String) #-}--data Env =- Env- { hostString :: String- , portString :: String- , host :: Maybe NS.HostAddress- , port :: Maybe NS.PortNumber- , user :: String- , password :: String- , database :: String- }--spec :: Spec-spec = do- beforeAll- ( do- hostString <- getEnvDef "PURE_HOST" "127.0.0.1"- portString <- getEnvDef "PURE_PORT" "5432"- let- host = fromEitherToMaybe $ parseHostIPv4 $ BSC.pack hostString- port = readMaybe portString :: Maybe NS.PortNumber- user <- getEnvDef "PURE_USER" "postgres"- password <- getEnvDef "PURE_PASSWORD" ""- database <- getEnvDef "PURE_DATABASE" "postgres"- pure Env { hostString, portString, host, port, user, password, database }- )- $ do- describe "connection" $ do- describe "connect/disconnect" $ do- it "resolved address" $ \Env { host, port, user, password, database } -> do- case (host, port) of- (Just host, Just port) -> do- let- config =- def- { address = AddressResolved $ NS.SockAddrInet port host- , user- , password- , database- }- conn <- connect config- disconnect conn- _ -> pendingWith "the given host and port are not resolved"-- it "not-resolved address" $ \Env { hostString, portString, user, password, database } -> do- let- config =- def- { address = AddressNotResolved hostString portString- , user- , password- , database- }- conn <- connect config- disconnect conn-- it "withConnection" $ \Env { hostString, portString, user, password, database } -> do- let- config =- def- { address = AddressNotResolved hostString portString- , user- , password- , database- }- withConnection config (const $ pure ())-- beforeAllWith- ( \Env { hostString, portString, user, password, database } -> do- let- config =- def- { address = AddressNotResolved hostString portString- , user- , password- , database- }- connect config- )- $ afterAll- disconnect- $ do- describe "CREATE TABLE/DROP TABLE" $ do- it "hints, hints" $ \conn -> do- let- e0 = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "CREATE TABLE test (value INT NOT NULL)" (Just (T.Empty, T.Empty))- e1 = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "DROP TABLE IF EXISTS test" (Just (T.Empty, T.Empty))- (((_, _, e0, _), (_, _, e1, _)), ts) <- sync conn (e0, e1)- ts `shouldBe` Idle- result e0 `shouldBe` ExecuteComplete CreateTableTag- records e0 `shouldBe` ([] :: [()])- result e1 `shouldBe` ExecuteComplete DropTableTag- records e1 `shouldBe` ([] :: [()])-- it "no hints, no hints" $ \conn -> do- let- e0 = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "CREATE TABLE test (value INT NOT NULL)" Nothing- e1 = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "DROP TABLE IF EXISTS test" Nothing- (((_, _, e0, _), (_, _, e1, _)), ts) <- sync conn (e0, e1)- ts `shouldBe` Idle- result e0 `shouldBe` ExecuteComplete CreateTableTag- records e0 `shouldBe` ([] :: [()])- result e1 `shouldBe` ExecuteComplete DropTableTag- records e1 `shouldBe` ([] :: [()])-- beforeWith- ( \conn -> do- let- e0 = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "CREATE TABLE test (value INT NOT NULL)" (Just (T.Empty, T.Empty))- e1 = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "INSERT INTO test (value) VALUES (0), (1), (2)" (Just (T.Empty, T.Empty))- (((_, _, e0, _), (_, _, e1, _)), ts) <- sync conn (e0, e1)- ts `shouldBe` Idle- result e0 `shouldBe` ExecuteComplete CreateTableTag- records e0 `shouldBe` ([] :: [()])- result e1 `shouldSatisfy` \(ExecuteComplete (InsertTag _ 3)) -> True- records e1 `shouldBe` ([] :: [()])- pure conn- )- $ after- ( \conn -> do- let- e = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "DROP TABLE IF EXISTS test" (Just (T.Empty, T.Empty))- ((_, _, e, _), ts) <- sync conn e- ts `shouldBe` Idle- result e `shouldBe` ExecuteComplete DropTableTag- records e `shouldBe` ([] :: [()])- )- $ do- describe "table: test (value INT NOT NULL)" $ do- it "DELETE FROM test WHERE value = 0" $ \conn -> do- let- e = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "DELETE FROM test WHERE value = 0" (Just (T.Empty, T.Empty))- ((_, _, e, _), ts) <- sync conn e- ts `shouldBe` Idle- result e `shouldBe` ExecuteComplete (DeleteTag 1)- records e `shouldBe` ([] :: [()])-- it "UPDATE test SET value = 10 WHERE value = 1" $ \conn -> do- let- e = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "UPDATE test SET value = 10 WHERE value = 1" (Just (T.Empty, T.Empty))- ((_, _, e, _), ts) <- sync conn e- ts `shouldBe` Idle- result e `shouldBe` ExecuteComplete (UpdateTag 1)- records e `shouldBe` ([] :: [()])-- it "SELECT value FROM test ORDER BY value (get all)" $ \conn -> do- let- e = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "SELECT value FROM test ORDER BY value" (Just (T.Empty, Only Oid.int4))- ((_, _, e, _), ts) <- sync conn e- ts `shouldBe` Idle- result e `shouldBe` ExecuteComplete (SelectTag 3)- records e `shouldBe` ([Only 0, Only 1, Only 2] :: [Only Int])-- it "SELECT value FROM test ORDER BY value (get a part)" $ \conn -> do- let- e = execute 1 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "SELECT value FROM test ORDER BY value" (Just (T.Empty, Only Oid.int4))- ((_, _, e, _), ts) <- sync conn e- ts `shouldBe` Idle- result e `shouldBe` ExecuteSuspended- records e `shouldBe` ([Only 0] :: [Only Int])-- it "SELECT value FROM test ORDER BY value (reuse portal)" $ \conn -> do- let- p = forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "SELECT value FROM test ORDER BY value" (Just (T.Empty, Only Oid.int4))- e = execute 2 (pure . BSU.toString) p- (_, p, e, _) <- flush conn e- result e `shouldBe` ExecuteSuspended- records e `shouldBe` ([Only 0, Only 1] :: [Only Int])- let- e = execute 1 (pure . BSU.toString) p- (_, _, e, _) <- flush conn e- result e `shouldBe` ExecuteSuspended- records e `shouldBe` ([Only 2] :: [Only Int])- let- e = execute 1 (pure . BSU.toString) p- ((_, _, e, _), ts) <- sync conn e- ts `shouldBe` Idle- result e `shouldBe` ExecuteComplete (SelectTag 0)- records e `shouldBe` ([] :: [Only Int])-- it "SELECT value FROM test WHERE value = $1 (reuse prepared statement)" $ \conn -> do- let- ps = parse "" "SELECT value FROM test WHERE value = $1" (Just (Only Oid.int4, Only Oid.int4))- e = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) (Only (0 :: Int32)) ps- ((ps, _, e, _), ts) <- sync conn e- ts `shouldBe` Idle- result e `shouldBe` ExecuteComplete (SelectTag 1)- records e `shouldBe` [Only (0 :: Int)]- let- e = execute 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) (Only (2 :: Int32)) ps- ((_, _, e, _), ts) <- sync conn e- ts `shouldBe` Idle- result e `shouldBe` ExecuteComplete (SelectTag 1)- records e `shouldBe` [Only (2 :: Int)]-- it "BEGIN/ROLLBACK" $ \conn -> do- ((_, _, e, _), ts) <- sync conn begin- ts `shouldBe` Block- result e `shouldBe` ExecuteComplete BeginTag- records e `shouldBe` []- ((_, _, e, _), ts) <- sync conn rollback- ts `shouldBe` Idle- result e `shouldBe` ExecuteComplete RollbackTag- records e `shouldBe` []-- it "BEGIN/COMMIT" $ \conn -> do- ((_, _, e, _), ts) <- sync conn begin- ts `shouldBe` Block- result e `shouldBe` ExecuteComplete BeginTag- records e `shouldBe` []- ((_, _, e, _), ts) <- sync conn commit- ts `shouldBe` Idle- result e `shouldBe` ExecuteComplete CommitTag- records e `shouldBe` []-- describe "invalid SQL" $ do- it "parse sync" $ \conn -> do- let- ps = parse "" "INVALID SQL" (Just (T.Empty, T.Empty))- sync conn ps `shouldThrow` (\ErrorResponse {} -> True)-- it "parse flush" $ \conn -> do- let- ps = parse "" "INVALID SQL" (Just (T.Empty, T.Empty))- flush conn ps `shouldThrow` (\ErrorResponse {} -> True)-- describe "invalid parameter type" $ do- it "parse sync" $ \conn -> do- let- ps = parse "" "SELECT value FROM test WHERE value = $1" (Just (Only Oid.varchar, Only Oid.int4))- void $ sync conn ps `shouldThrow` (\ErrorResponse {} -> True)-- it "parse flush" $ \conn -> do- let- ps = parse "" "SELECT value FROM test WHERE value = $1" (Just (Only Oid.varchar, Only Oid.int4))- void $ flush conn ps `shouldThrow` (\ErrorResponse {} -> True)-- describe "invalid result type" $ do- it "parse/bind sync" $ \conn -> do- let- p = forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "SELECT value FROM test ORDER BY value LIMIT 1" (Just (T.Empty, Only Oid.varchar))- ((_, _), ts) <- sync conn p- ts `shouldBe` Idle-- it "parse/bind flush" $ \conn -> do- let- p = forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "SELECT value FROM test ORDER BY value LIMIT 1" (Just (T.Empty, Only Oid.varchar))- void $ flush conn p-- it "parse/bind/execute sync" $ \conn -> do- let- e = execute @_ @_ @(Only Int) 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "SELECT value FROM test ORDER BY value LIMIT 1" (Just (T.Empty, Only Oid.varchar))- sync conn e `shouldThrow` (\ResponseParsingFailed {} -> True)-- it "parse/bind/execute flush" $ \conn -> do- let- e = execute @_ @_ @(Only Int) 0 (pure . BSU.toString) $ forceRight $ bind "" BinaryFormat BinaryFormat (parameters conn) (pure . BSU.fromString) () $ parse "" "SELECT value FROM test ORDER BY value LIMIT 1" (Just (T.Empty, Only Oid.varchar))- flush conn e `shouldThrow` (\ResponseParsingFailed {} -> True)--getEnvDef :: String -> String -> IO String-getEnvDef name value = fromMaybe value <$> lookupEnv name--parseHostIPv4 :: BS.ByteString -> Either String NS.HostAddress-parseHostIPv4 =- AP.parseOnly ipv4Parser- where- ipv4Parser = do- p1 <- AP.decimal- void $ AP.char '.'- p2 <- AP.decimal- void $ AP.char '.'- p3 <- AP.decimal- void $ AP.char '.'- p4 <- AP.decimal- pure $ NS.tupleToHostAddress (p1, p2, p3, p4)--fromEitherToMaybe :: Either a b -> Maybe b-fromEitherToMaybe (Left _) = Nothing-fromEitherToMaybe (Right b) = Just b--forceRight :: Either String a -> a-forceRight (Right a) = a-forceRight (Left e) = error $ "forceRight: " <> e
− test/Spec.hs
@@ -1,1 +0,0 @@-{-# OPTIONS_GHC -F -pgmF hspec-discover #-}
− test/Test/Hspec/Core/Hooks/Extra.hs
@@ -1,30 +0,0 @@-module Test.Hspec.Core.Hooks.Extra- ( beforeAllWith- ) where--import Test.Hspec.Core.Hooks-import Test.Hspec.Core.Spec--import Control.Concurrent.MVar (MVar, modifyMVar, newMVar)-import Control.Exception (SomeException, throwIO, try)--data Memoized a =- Empty- | Memoized a- | Failed SomeException--memoize :: MVar (Memoized a) -> IO a -> IO a-memoize mvar action = do- result <- modifyMVar mvar $ \ma -> case ma of- Empty -> do- a <- try action- return (either Failed Memoized a, a)- Memoized a -> return (ma, Right a)- Failed _ -> throwIO (Pending Nothing (Just "exception in beforeAll-hook (see previous failure)"))- either throwIO return result---- | Run a custom action befor the first spec item.-beforeAllWith :: (b -> IO a) -> SpecWith a -> SpecWith b-beforeAllWith action spec = do- mver <- runIO (newMVar Empty)- beforeWith (memoize mver . action) spec