@@ -27,18 +27,22 @@ main = do
2727 connectionString <- pure
2828 "host=localhost port=5432 dbname=exampledb"
2929 Char8.putStrLn $ "connecting to " <> connectionString
30− connection0 <- connectdb connectionString
30+ connection0 :: Connection '[] <- connectdb connectionString
3131 Char8.putStrLn "setting up database"
3232 connection1 <- flip execPQ connection0 $
33− pqExec ( createTable #students
34− ( (text & notNull) `As` #name
35− :* Nil ) )
36− &>> createTable #table1
37− ( (int4 & notNull) `As` #col1
38− :* (int4 & notNull) `As` #col2
39− :* Nil )
40− &>> insertInto #table1 ( 1 `As` #col1 :* 2 `As` #col2 :* Nil )
41− &>> insertInto #table1 ( 3 `As` #col1 :* 4 `As` #col2 :* Nil )
33+ pqExec
34+ ( createTable #students
35+ ( (text & notNull) `As` #name
36+ :* Nil ) )
37+ & (pqThen . pqExec)
38+ ( createTable #table1
39+ ( (int4 & notNull) `As` #col1
40+ :* (int4 & notNull) `As` #col2
41+ :* Nil ) )
42+ & (pqThen . pqExec)
43+ ( insertInto #table1 ( 1 `As` #col1 :* 2 `As` #col2 :* Nil ) )
44+ & (pqThen . pqExec)
45+ ( insertInto #table1 ( 3 `As` #col1 :* 4 `As` #col2 :* Nil ) )
4246 Char8.putStrLn "querying"
4347 connection2 <- flip execPQ connection1 $ do
4448 Just result <- pqExecNil $ select $ starFrom #table1
@@ -59,7 +63,7 @@ main = do
5963 Char8.putStrLn "tearing down database"
6064 connection3 :: Connection '[] <- flip execPQ connection2 $ pqExec
6165 (dropTable #table1 :: Statement '[] '[] Tables '["students" ::: StudentsColumns])
62− &>> dropTable #students
66+ & (pqThen . pqExec) (dropTable #students)
6367 finish connection3
6468
6569type Columns =