on dev help sign in
Remove monokinded empty list types
commitec71cbe183deb016483a3acf381c9caec77f98e6 authorEitan Chatav <eitan.chatav@gmail.com> dateSat 1 Sep 2018, 09:47 (8 years ago) parent3fe22f6
2 files changed+6−11
squeal-postgresql/src/Squeal/PostgreSQL/Schema.hs−7 squeal-postgresql/src/Squeal/PostgreSQL/Transaction.hs+6−4
squeal-postgresql/src/Squeal/PostgreSQL/Schema.hs−7
@@ -42,7 +42,6 @@ module Squeal.PostgreSQL.Schema
4242 -- * Tables
4343 , ColumnsType
4444 , RowType
45− , NilRelation
4645 , FromType
4746 , TableType
4847 -- * Schema
@@ -53,7 +52,6 @@ module Squeal.PostgreSQL.Schema
5352 , ColumnConstraint (..)
5453 , TableConstraint (..)
5554 , TableConstraints
56− , NilTableConstraints
5755 , Uniquely
5856 -- * Aliases
5957 , (:::)
@@ -284,9 +282,6 @@ data TableConstraint
284282
285283-- | A `TableConstraints` is a row of `TableConstraint`s.
286284type TableConstraints = [(Symbol,TableConstraint)]
287−-- | A monokinded empty `TableConstraints`.
288−type family NilTableConstraints :: TableConstraints where
289− NilTableConstraints = '[]
290285
291286-- | A `ForeignKey` must reference columns that either are
292287-- a `PrimaryKey` or form a `Unique` constraint.
@@ -321,8 +316,6 @@ type TableType = (TableConstraints,ColumnsType)
321316-- ]
322317-- :}
323318type RowType = [(Symbol,NullityType)]
324−-- | A monokinded empty `RowType`.
325−type family NilRelation :: RowType where NilRelation = '[]
326319
327320-- | `FromType` is a row of `RowType`s, thought of as a product.
328321type FromType = [(Symbol,RowType)]
squeal-postgresql/src/Squeal/PostgreSQL/Transaction.hs+6−4
@@ -9,9 +9,11 @@ Squeal transaction control language.
99-}
1010
1111{-# LANGUAGE
12− FlexibleContexts
12+ DataKinds
13+ , FlexibleContexts
1314 , LambdaCase
1415 , OverloadedStrings
16+ , TypeInType
1517#-}
1618
1719module Squeal.PostgreSQL.Transaction
@@ -69,16 +71,16 @@ transactionally_
6971transactionally_ = transactionally defaultMode
7072
7173-- | @BEGIN@ a transaction.
72−begin :: MonadPQ schema tx => TransactionMode -> tx (K Result NilRelation)
74+begin :: MonadPQ schema tx => TransactionMode -> tx (K Result ('[] :: RowType))
7375begin mode = manipulate . UnsafeManipulation $
7476 "BEGIN" <+> renderTransactionMode mode <> ";"
7577
7678-- | @COMMIT@ a schema invariant transaction.
77−commit :: MonadPQ schema tx => tx (K Result NilRelation)
79+commit :: MonadPQ schema tx => tx (K Result ('[] :: RowType))
7880commit = manipulate $ UnsafeManipulation "COMMIT;"
7981
8082-- | @ROLLBACK@ a schema invariant transaction.
81−rollback :: MonadPQ schema tx => tx (K Result NilRelation)
83+rollback :: MonadPQ schema tx => tx (K Result ('[] :: RowType))
8284rollback = manipulate $ UnsafeManipulation "ROLLBACK;"
8385
8486-- | Run a schema changing computation `transactionallySchema`.