@@ -114,12 +114,13 @@ data NullityType
114 | NotNull PGType -- ^ @NULL@ is absent
114 | NotNull PGType -- ^ @NULL@ is absent
116-- | `ColumnType` encodes the allowance of @DEFAULT@ and the only way
116-- | `ColumnType` encodes the allowance of @DEFAULT@ and the only way
117−-- to generate an `Optional` `Squeal.PostgreSQL.Statement.Expression`
117+-- to generate an `Optional` `Squeal.PostgreSQL.Expression.Expression`
118−-- is to use `Squeal.PostgreSQL.Statement.def`,
118+-- is to use `Squeal.PostgreSQL.Expression.def`,
119−-- `Squeal.PostgreSQL.Statement.unDef` or `Squeal.PostgreSQL.Statement.param`.
119+-- `Squeal.PostgreSQL.Expression.unDef` or
120+-- `Squeal.PostgreSQL.Expression.param`.
120data ColumnType
121data ColumnType
121 = Optional NullityType
122 = Optional NullityType
122− -- ^ @DEFAULT@ is an allowed `Squeal.PostgreSQL.Statement.Expression`
123+ -- ^ @DEFAULT@ is allowed
123 | Required NullityType
124 | Required NullityType
124 -- ^ @DEFAULT@ is not allowed
125 -- ^ @DEFAULT@ is not allowed
@@ -128,30 +129,30 @@ type ColumnsType = [(Symbol,ColumnType)]
129-- | `TablesType` is a kind synonym for a row of `ColumnsType`s.
130-- | `TablesType` is a kind synonym for a row of `ColumnsType`s.
130-- It is used as a kind for both a schema, a disjoint union of tables,
131-- It is used as a kind for both a schema, a disjoint union of tables,
131−-- and a joined table @FROM@ clause, a product of tables.
132+-- and a joined table `Squeal.Query.FromClause`, a product of tables.
132type TablesType = [(Symbol,ColumnsType)]
133type TablesType = [(Symbol,ColumnsType)]
134-- | `Grouping` is an auxiliary namespace, created by
135-- | `Grouping` is an auxiliary namespace, created by
135−-- @GROUP BY@ clauses (`Squeal.PostgreSQL.Statement.group`), and used
136+-- @GROUP BY@ clauses (`Squeal.PostgreSQL.Query.group`), and used
136-- for typesafe aggregation
137-- for typesafe aggregation
137data Grouping
138data Grouping
138 = Ungrouped
139 = Ungrouped
139 | Grouped [(Symbol,Symbol)]
140 | Grouped [(Symbol,Symbol)]
141-- | `PGNum` is a constraint on `PGType` whose
142-- | `PGNum` is a constraint on `PGType` whose
142−-- `Squeal.PostgreSQL.Statement.Expression`s have a `Num` constraint.
143+-- `Squeal.PostgreSQL.Expression.Expression`s have a `Num` constraint.
143type PGNum ty =
144type PGNum ty =
144 In ty '[ 'PGint2, 'PGint4, 'PGint8, 'PGnumeric, 'PGfloat4, 'PGfloat8]
145 In ty '[ 'PGint2, 'PGint4, 'PGint8, 'PGnumeric, 'PGfloat4, 'PGfloat8]
146-- | `PGFloating` is a constraint on `PGType` whose
147-- | `PGFloating` is a constraint on `PGType` whose
147−-- `Squeal.PostgreSQL.Statement.Expression`s
148+-- `Squeal.PostgreSQL.Expression.Expression`s
148-- have `Fractional` and `Floating` constraints.
149-- have `Fractional` and `Floating` constraints.
149type PGFloating ty = In ty '[ 'PGfloat4, 'PGfloat8, 'PGnumeric]
150type PGFloating ty = In ty '[ 'PGfloat4, 'PGfloat8, 'PGnumeric]
151-- | `PGIntegral` is a constraint on `PGType` whose
152-- | `PGIntegral` is a constraint on `PGType` whose
152−-- `Squeal.PostgreSQL.Statement.Expression`s
153+-- `Squeal.PostgreSQL.Expression.Expression`s
153−-- have `Squeal.PostgreSQL.Statement.div_` and
154+-- have `Squeal.PostgreSQL.Expression.div_` and
154−-- `Squeal.PostgreSQL.Statement.mod_` functions.
155+-- `Squeal.PostgreSQL.Expression.mod_` functions.
155type PGIntegral ty = In ty '[ 'PGint2, 'PGint4, 'PGint8]
156type PGIntegral ty = In ty '[ 'PGint2, 'PGint4, 'PGint8]
157-- | `:::` is the promoted version of `As`, a type level pair between
158-- | `:::` is the promoted version of `As`, a type level pair between
@@ -259,43 +260,43 @@ type family NullifyColumns (columns :: ColumnsType) :: ColumnsType where
260-- | `NullifyTables` is an idempotent that nullifies a `TablesType`
261-- | `NullifyTables` is an idempotent that nullifies a `TablesType`
261-- used to nullify the left or right hand side of an outer join
262-- used to nullify the left or right hand side of an outer join
262−-- in a `Squeal.PostgreSQL.Statement.FromClause`
263+-- in a `Squeal.PostgreSQL.Query.FromClause`
263type family NullifyTables (tables :: TablesType) :: TablesType where
264type family NullifyTables (tables :: TablesType) :: TablesType where
264 NullifyTables '[] = '[]
265 NullifyTables '[] = '[]
265 NullifyTables ((table ::: columns) ': tables) =
266 NullifyTables ((table ::: columns) ': tables) =
266 (table ::: NullifyColumns columns) ': NullifyTables tables
267 (table ::: NullifyColumns columns) ': NullifyTables tables
268-- | `Join` is simply promoted `++` and is used in @JOIN@s in
269-- | `Join` is simply promoted `++` and is used in @JOIN@s in
269−-- `Squeal.PostgreSQL.Statement.FromClause`s.
270+-- `Squeal.PostgreSQL.Query.FromClause`s.
270type family Join xs ys where
271type family Join xs ys where
271 Join '[] ys = ys
272 Join '[] ys = ys
272 Join (x ': xs) ys = x ': Join xs ys
273 Join (x ': xs) ys = x ': Join xs ys
274−-- | `Create alias x xs` adds `alias ::: x` to the end of `xs` and is used in
275+-- | @Create alias x xs@ adds @alias ::: x@ to the end of @xs@ and is used in
275−-- `Squeal.PostgreSQL.Statement.createTable` statements and in @ALTER TABLE@
276+-- `Squeal.PostgreSQL.Definition.createTable` statements and in @ALTER TABLE@
276−-- `Squeal.PostgreSQL.Statement.addColumnDefault` and
277+-- `Squeal.PostgreSQL.Definition.addColumnDefault` and
277−-- `Squeal.PostgreSQL.Statement.addColumnNull` statements
278+-- `Squeal.PostgreSQL.Definition.addColumnNull` statements.
278type family Create alias x xs where
279type family Create alias x xs where
279 Create alias x '[] = '[alias ::: x]
280 Create alias x '[] = '[alias ::: x]
280 Create alias y (x ': xs) = x ': Create alias y xs
281 Create alias y (x ': xs) = x ': Create alias y xs
282−-- | `Drop alias xs` removes the type associated with `alias` in `xs`
283+-- | @Drop alias xs@ removes the type associated with @alias@ in @xs@
283−-- and is used in `Squeal.PostgreSQL.Statement.dropTable` statements
284+-- and is used in `Squeal.PostgreSQL.Definition.dropTable` statements
284−-- and in @ALTER TABLE@ `Squeal.PostgreSQL.Statement.dropColumn` statements
285+-- and in @ALTER TABLE@ `Squeal.PostgreSQL.Definition.dropColumn` statements.
285type family Drop alias xs where
286type family Drop alias xs where
286 Drop alias ((alias ::: x) ': xs) = xs
287 Drop alias ((alias ::: x) ': xs) = xs
287 Drop alias (x ': xs) = x ': Drop alias xs
288 Drop alias (x ': xs) = x ': Drop alias xs
289−-- | `Alter alias xs x` replaces the type associated with an `alias` in `xs`
290+-- | @Alter alias xs x@ replaces the type associated with an @alias@ in @xs@
290−-- with the type `x` and is used in `Squeal.PostgreSQL.Statement.alterTable`
291+-- with the type `x` and is used in `Squeal.PostgreSQL.Definition.alterTable`
291−-- and `Squeal.PostgreSQL.Statement.alterColumn`.
292+-- and `Squeal.PostgreSQL.Definition.alterColumn`.
292type family Alter alias xs x where
293type family Alter alias xs x where
293 Alter alias ((alias ::: x0) ': xs) x1 = (alias ::: x1) ': xs
294 Alter alias ((alias ::: x0) ': xs) x1 = (alias ::: x1) ': xs
294 Alter alias (x0 ': xs) x1 = x0 ': Alter alias xs x1
295 Alter alias (x0 ': xs) x1 = x0 ': Alter alias xs x1
296−-- | `Rename alias0 alias1 xs` replaces the alias `alias0` by `alias1` in `xs`
297+-- | @Rename alias0 alias1 xs@ replaces the alias @alias0@ by @alias1@ in @xs@
297−-- and is used in `Squeal.PostgreSQL.Statement.alterTableRename` and
298+-- and is used in `Squeal.PostgreSQL.Definition.alterTableRename` and
298−-- `Squeal.PostgreSQL.Statement.renameColumn`
299+-- `Squeal.PostgreSQL.Definition.renameColumn`.
299type family Rename alias0 alias1 xs where
300type family Rename alias0 alias1 xs where
300 Rename alias0 alias1 ((alias0 ::: x0) ': xs) = (alias1 ::: x0) ': xs
301 Rename alias0 alias1 ((alias0 ::: x0) ': xs) = (alias1 ::: x0) ': xs
301 Rename alias0 alias1 (x ': xs) = x ': Rename alias0 alias1 xs
302 Rename alias0 alias1 (x ': xs) = x ': Rename alias0 alias1 xs