@@ -23,7 +23,7 @@ spec = do
2323 query `shouldRenderAs` str = renderStatement query `shouldBe` str
2424 it "correctly renders a simple SELECT query" $ do
2525 let
26− statement :: Statement '[] Tables Tables SumAndCol1
26+ statement :: Statement '[] SumAndCol1 Tables Tables
2727 statement = select $
2828 ((#col1 + #col2) `As` #sum :& #col1 :& RNil)
2929 `from` (#table1 & where_ true)
@@ -31,7 +31,7 @@ spec = do
3131 "SELECT (col1 + col2) AS sum, col1 AS col1 FROM table1 AS table1 WHERE TRUE;"
3232 it "combines WHEREs using AND" $ do
3333 let
34− statement :: Statement '[] Tables Tables SumAndCol1
34+ statement :: Statement '[] SumAndCol1 Tables Tables
3535 statement = select $
3636 ((#col1 + #col2) `As` #sum :& #col1 :& RNil)
3737 `from` (#table1 & where_ true & where_ false)
@@ -40,45 +40,45 @@ spec = do
4040 it "performs sub SELECTs" $ do
4141 let
4242 selection = ((#col1 + #col2) `As` #sum :& #col1 :& RNil) `from` #table1
43− statement :: Statement '[] Tables Tables SumAndCol1
43+ statement :: Statement '[] SumAndCol1 Tables Tables
4444 statement = select $ starFrom (subselect (selection `As` #sub))
4545 statement `shouldRenderAs`
4646 "SELECT * FROM SELECT (col1 + col2) AS sum, col1 AS col1 FROM table1 AS table1 AS sub;"
4747 it "does LIMIT clauses" $ do
4848 let
49− statement :: Statement '[] Tables Tables Columns
49+ statement :: Statement '[] Columns Tables Tables
5050 statement = select $ starFrom (#table1 & limit 1)
5151 statement `shouldRenderAs` "SELECT * FROM table1 AS table1 LIMIT 1;"
5252 it "should use the minimum of given LIMITs" $ do
5353 let
54− statement :: Statement '[] Tables Tables Columns
54+ statement :: Statement '[] Columns Tables Tables
5555 statement = select $ starFrom (#table1 & limit 1 & limit 2)
5656 statement `shouldRenderAs`
5757 "SELECT * FROM table1 AS table1 LIMIT CASE WHEN (1 <= 2) THEN 1 ELSE 2 END;"
5858 it "should render parameters using $ signs" $ do
5959 let
60− statement :: Statement '[ 'NotNull 'PGInt8] Tables Tables Columns
60+ statement :: Statement '[ 'NotNull 'PGInt8] Columns Tables Tables
6161 statement = select $ starFrom (#table1 & limit param1)
6262 statement `shouldRenderAs` "SELECT * FROM table1 AS table1 LIMIT $1;"
6363 it "does OFFSET clauses" $ do
6464 let
65− statement :: Statement '[] Tables Tables Columns
65+ statement :: Statement '[] Columns Tables Tables
6666 statement = select $ starFrom (#table1 & offset 1)
6767 statement `shouldRenderAs` "SELECT * FROM table1 AS table1 OFFSET 1;"
6868 it "should use the sum of given OFFSETs" $ do
6969 let
70− statement :: Statement '[] Tables Tables Columns
70+ statement :: Statement '[] Columns Tables Tables
7171 statement = select $ starFrom (#table1 & offset 1 & offset 2)
7272 statement `shouldRenderAs` "SELECT * FROM table1 AS table1 OFFSET (1 + 2);"
7373 it "correctly render simple INSERTs" $ do
7474 let
75− statement :: Statement '[] Tables Tables '[]
75+ statement :: Statement '[] '[] Tables Tables
7676 statement = insertInto #table1 $ 2 `As` #col1 :& 4 `As` #col2 :& RNil
7777 statement `shouldRenderAs`
7878 "INSERT INTO table1 (col1, col2) VALUES (2, 4);"
7979 it "should be safe against SQL injection in literal text" $ do
8080 let
81− statement :: Statement '[] StudentsTable StudentsTable '[]
81+ statement :: Statement '[] '[] StudentsTable StudentsTable
8282 statement = insertInto #students $
8383 "Robert'); DROP TABLE students;" `As` #name :& RNil
8484 statement `shouldRenderAs`
@@ -91,7 +91,7 @@ spec = do
9191 :& #shippers &. #shipperVal `As` #shipperVal :& RNil
9292 it "should render CROSS JOINs" $ do
9393 let
94− statement :: Statement '[] JoinTables JoinTables ValueColumns
94+ statement :: Statement '[] ValueColumns JoinTables JoinTables
9595 statement = select $ vals `from`
9696 (join (#orders & Cross #customers & Cross #shippers))
9797 statement `shouldRenderAs`
@@ -111,7 +111,7 @@ spec = do
111111 (#orders &. #customerID ==* #customers &. #customerID)
112112 & Inner #shippers
113113 (#orders &. #shipperID ==* #shippers &. #shipperID)
114− selection :: Statement '[] JoinTables JoinTables ValueColumns
114+ selection :: Statement '[] ValueColumns JoinTables JoinTables
115115 selection = select $ vals `from` innerJoins
116116 selection `shouldRenderAs`
117117 "SELECT\
@@ -125,7 +125,7 @@ spec = do
125125 \ ON (orders.shipperID = shippers.shipperID);"
126126 it "should render self JOINs" $ do
127127 let
128− statement :: Statement '[] JoinTables JoinTables OrderColumns
128+ statement :: Statement '[] OrderColumns JoinTables JoinTables
129129 statement = select $ #orders1 `dotStarFrom`
130130 (join (Table (#orders `As` #orders1)
131131 & Cross (#orders `As` #orders2)))
@@ -135,13 +135,13 @@ spec = do
135135 \ CROSS JOIN orders AS orders2;"
136136 it "should render simple CREATE TABLE statements" $ do
137137 let
138− statement :: Statement '[] '[] Tables '[]
138+ statement :: Statement '[] '[] '[] Tables
139139 statement = createTable #table1 (proxy# :: Proxy# Columns)
140140 statement `shouldRenderAs`
141141 "CREATE TABLE table1 (col1 int4 NOT NULL, col2 int4 NOT NULL);"
142142 it "should render DROP TABLE statements" $ do
143143 let
144− statement :: Statement '[] Tables '[] '[]
144+ statement :: Statement '[] '[] Tables '[]
145145 statement = dropTable #table1
146146 statement `shouldRenderAs` "DROP TABLE table1;"
147147