on dev help sign in
Remove monokinded empty list types
ec71cbeEitan Chatav
squeal-postgresql/src/Squeal/PostgreSQL/Schema.hs−7
@@ -42,7 +42,6 @@ module Squeal.PostgreSQL.Schema
42 -- * Tables
42 -- * Tables
43 , ColumnsType
43 , ColumnsType
44 , RowType
44 , RowType
45− , NilRelation
46 , FromType
45 , FromType
47 , TableType
46 , TableType
48 -- * Schema
47 -- * Schema
@@ -53,7 +52,6 @@ module Squeal.PostgreSQL.Schema
53 , ColumnConstraint (..)
52 , ColumnConstraint (..)
54 , TableConstraint (..)
53 , TableConstraint (..)
55 , TableConstraints
54 , TableConstraints
56− , NilTableConstraints
57 , Uniquely
55 , Uniquely
58 -- * Aliases
56 -- * Aliases
59 , (:::)
57 , (:::)
@@ -284,9 +282,6 @@ data TableConstraint
284
282
285-- | A `TableConstraints` is a row of `TableConstraint`s.
283-- | A `TableConstraints` is a row of `TableConstraint`s.
286type TableConstraints = [(Symbol,TableConstraint)]
284type TableConstraints = [(Symbol,TableConstraint)]
287−-- | A monokinded empty `TableConstraints`.
288−type family NilTableConstraints :: TableConstraints where
289− NilTableConstraints = '[]
290
285
291-- | A `ForeignKey` must reference columns that either are
286-- | A `ForeignKey` must reference columns that either are
292-- a `PrimaryKey` or form a `Unique` constraint.
287-- a `PrimaryKey` or form a `Unique` constraint.
@@ -321,8 +316,6 @@ type TableType = (TableConstraints,ColumnsType)
321-- ]
316-- ]
322-- :}
317-- :}
323type RowType = [(Symbol,NullityType)]
318type RowType = [(Symbol,NullityType)]
324−-- | A monokinded empty `RowType`.
325−type family NilRelation :: RowType where NilRelation = '[]
326
319
327-- | `FromType` is a row of `RowType`s, thought of as a product.
320-- | `FromType` is a row of `RowType`s, thought of as a product.
328type FromType = [(Symbol,RowType)]
321type FromType = [(Symbol,RowType)]
squeal-postgresql/src/Squeal/PostgreSQL/Transaction.hs+6−4
@@ -9,9 +9,11 @@ Squeal transaction control language.
9-}
9-}
10
10
11{-# LANGUAGE
11{-# LANGUAGE
12+ DataKinds
12− FlexibleContexts
13+ , FlexibleContexts
13 , LambdaCase
14 , LambdaCase
14 , OverloadedStrings
15 , OverloadedStrings
16+ , TypeInType
15#-}
17#-}
16
18
17module Squeal.PostgreSQL.Transaction
19module Squeal.PostgreSQL.Transaction
@@ -69,16 +71,16 @@ transactionally_
69transactionally_ = transactionally defaultMode
71transactionally_ = transactionally defaultMode
70
72
71-- | @BEGIN@ a transaction.
73-- | @BEGIN@ a transaction.
72−begin :: MonadPQ schema tx => TransactionMode -> tx (K Result NilRelation)
74+begin :: MonadPQ schema tx => TransactionMode -> tx (K Result ('[] :: RowType))
73begin mode = manipulate . UnsafeManipulation $
75begin mode = manipulate . UnsafeManipulation $
74 "BEGIN" <+> renderTransactionMode mode <> ";"
76 "BEGIN" <+> renderTransactionMode mode <> ";"
75
77
76-- | @COMMIT@ a schema invariant transaction.
78-- | @COMMIT@ a schema invariant transaction.
77−commit :: MonadPQ schema tx => tx (K Result NilRelation)
79+commit :: MonadPQ schema tx => tx (K Result ('[] :: RowType))
78commit = manipulate $ UnsafeManipulation "COMMIT;"
80commit = manipulate $ UnsafeManipulation "COMMIT;"
79
81
80-- | @ROLLBACK@ a schema invariant transaction.
82-- | @ROLLBACK@ a schema invariant transaction.
81−rollback :: MonadPQ schema tx => tx (K Result NilRelation)
83+rollback :: MonadPQ schema tx => tx (K Result ('[] :: RowType))
82rollback = manipulate $ UnsafeManipulation "ROLLBACK;"
84rollback = manipulate $ UnsafeManipulation "ROLLBACK;"
83
85
84-- | Run a schema changing computation `transactionallySchema`.
86-- | Run a schema changing computation `transactionallySchema`.