@@ -1,9 +1,7 @@
1{-# LANGUAGE
1{-# LANGUAGE
4 , OverloadedLabels
3 , OverloadedLabels
5 , OverloadedStrings
4 , OverloadedStrings
7 , TypeApplications
5 , TypeApplications
8 , TypeOperators
6 , TypeOperators
@@ -29,9 +27,9 @@ main = do
29 connectionString <- pure
27 connectionString <- pure
30 "host=localhost port=5432 dbname=exampledb"
28 "host=localhost port=5432 dbname=exampledb"
31 Char8.putStrLn $ "connecting to " <> connectionString
29 Char8.putStrLn $ "connecting to " <> connectionString
32− connection0 :: Connection '[] <- connectdb connectionString
30+ connection0 <- connectdb connectionString
33 Char8.putStrLn "setting up database"
31 Char8.putStrLn "setting up database"
34− connection1 :: Connection Tables <- flip execPQ connection0 $ pqExec $
32+ connection1 <- flip execPQ (connection0 :: Connection '[]) $ pqExec $
35 createTable #students
33 createTable #students
36 ( (text & notNull) `As` #name
34 ( (text & notNull) `As` #name
@@ -41,7 +39,7 @@ main = do
41 :* (int4 & notNull) `As` #col2
39 :* (int4 & notNull) `As` #col2
43 Char8.putStrLn "querying"
41 Char8.putStrLn "querying"
44− connection2 :: Connection Tables <- flip execPQ connection1 $ do
42+ connection2 <- flip execPQ (connection1 :: Connection Tables) $ do
45 for_ [I i :* I (i+1) :* Nil | i <- [1::Int32,3..9]] $ pqExecParams
43 for_ [I i :* I (i+1) :* Nil | i <- [1::Int32,3..9]] $ pqExecParams
46 (insertInto #table1 (param1 `As` #col1 :* param2 `As` #col2 :* Nil))
44 (insertInto #table1 (param1 `As` #col1 :* param2 `As` #col2 :* Nil))
47 Just result <- pqExecNil . query $
45 Just result <- pqExecNil . query $
@@ -61,9 +59,9 @@ main = do
61 print (row0 :: NP I '[Int32,Int32])
59 print (row0 :: NP I '[Int32,Int32])
62 print (row1 :: NP I '[Int32,Int32])
60 print (row1 :: NP I '[Int32,Int32])
63 Char8.putStrLn "tearing down database"
61 Char8.putStrLn "tearing down database"
64− connection3 :: Connection '[] <- flip execPQ connection2 $ pqExec $
62+ connection3 <- flip execPQ (connection2 :: Connection Tables) $ pqExec $
65 dropTable #table1 >>> dropTable #students
63 dropTable #table1 >>> dropTable #students
66− finish connection3
64+ finish (connection3 :: Connection '[])
68type Columns =
66type Columns =
69 '[ "col1" ::: 'Required ('NotNull 'PGInt4)
67 '[ "col1" ::: 'Required ('NotNull 'PGInt4)