on dev help sign in
trim trailing whitespaces
06a7c05Eitan Chatav
squeal-postgresql/src/Squeal/PostgreSQL/Binary.hs+2−2
@@ -193,7 +193,7 @@ instance ToParam x ty => ToAliasedParam x (alias ::: ty) where
193 Nothing -> K Nothing
193 Nothing -> K Nothing
194 Just x -> K . Just . unK $ toParam @x @ty x
194 Just x -> K . Just . unK $ toParam @x @ty x
195
195
196−-- | A `ToColumnParam` constraint lifts the `ToParam` encoding
196+-- | A `ToColumnParam` constraint lifts the `ToParam` encoding
197-- of a `Type` to a `ColumnType`, encoding `Maybe`s to `Null`s. You should
197-- of a `Type` to a `ColumnType`, encoding `Maybe`s to `Null`s. You should
198-- not define instances of `ToColumnParam`, just use the provided instances.
198-- not define instances of `ToColumnParam`, just use the provided instances.
199class ToColumnParam (x :: Type) (ty :: NullityType) where
199class ToColumnParam (x :: Type) (ty :: NullityType) where
@@ -279,7 +279,7 @@ instance
279 , HasDatatypeInfo y
279 , HasDatatypeInfo y
280 , LabelsWith y ~ labels
280 , LabelsWith y ~ labels
281 ) => FromValue ('PGenum labels) y where
281 ) => FromValue ('PGenum labels) y where
282− fromValue _ =
282+ fromValue _ =
283 let
283 let
284 greadConstructor
284 greadConstructor
285 :: All ((~) '[]) xss
285 :: All ((~) '[]) xss
squeal-postgresql/src/Squeal/PostgreSQL/Definition.hs+2−2
@@ -338,7 +338,7 @@ primaryKey columns = UnsafeTableConstraintExpression $
338-- >>> :{
338-- >>> :{
339-- let
339-- let
340-- setup :: Definition '[] Schema
340-- setup :: Definition '[] Schema
341−-- setup =
341+-- setup =
342-- createTable #users
342-- createTable #users
343-- ( serial `As` #id :*
343-- ( serial `As` #id :*
344-- (text & hasNotNull) `As` #name :* Nil )
344-- (text & hasNotNull) `As` #name :* Nil )
@@ -372,7 +372,7 @@ primaryKey columns = UnsafeTableConstraintExpression $
372-- >>> :{
372-- >>> :{
373-- let
373-- let
374-- setup :: Definition '[] Schema
374-- setup :: Definition '[] Schema
375−-- setup =
375+-- setup =
376-- createTable #employees
376-- createTable #employees
377-- ( serial `As` #id :*
377-- ( serial `As` #id :*
378-- (text & hasNotNull) `As` #name :*
378-- (text & hasNotNull) `As` #name :*
squeal-postgresql/src/Squeal/PostgreSQL/Expression.hs+2−2
@@ -27,7 +27,7 @@ Squeal expressions are the atoms used to build statements.
27 , UndecidableInstances
27 , UndecidableInstances
28#-}
28#-}
29
29
30−module Squeal.PostgreSQL.Expression
30+module Squeal.PostgreSQL.Expression
31 ( -- * Expression
31 ( -- * Expression
32 Expression (UnsafeExpression, renderExpression)
32 Expression (UnsafeExpression, renderExpression)
33 , HasParameter (param)
33 , HasParameter (param)
@@ -223,7 +223,7 @@ instance (Has relation relations columns, Has column columns ty)
223 => IsQualified relation column
223 => IsQualified relation column
224 (NP (Aliased (Expression relations 'Ungrouped params)) '[column ::: ty]) where
224 (NP (Aliased (Expression relations 'Ungrouped params)) '[column ::: ty]) where
225 relation ! column = relation ! column :* Nil
225 relation ! column = relation ! column :* Nil
226−
226+
227instance
227instance
228 ( HasUnique relation relations columns
228 ( HasUnique relation relations columns
229 , Has column columns ty
229 , Has column columns ty
squeal-postgresql/src/Squeal/PostgreSQL/Manipulation.hs+1−1
@@ -144,7 +144,7 @@ let
144 , "col2" ::: 'NoDef :=> 'NotNull 'PGint4
144 , "col2" ::: 'NoDef :=> 'NotNull 'PGint4
145 ])
145 ])
146 ] '[] '[]
146 ] '[] '[]
147− manipulation =
147+ manipulation =
148 insertQuery_ #tab
148 insertQuery_ #tab
149 (selectStar (from (table (#other_tab `As` #t))))
149 (selectStar (from (table (#other_tab `As` #t))))
150in renderManipulation manipulation
150in renderManipulation manipulation
squeal-postgresql/src/Squeal/PostgreSQL/PQ.hs+2−2
@@ -166,7 +166,7 @@ instance Monad m => Functor (PQ schema0 schema1 m) where
166 K x <- pq conn
166 K x <- pq conn
167 return $ K (f x)
167 return $ K (f x)
168
168
169−-- | Run a `PQ` and keep the result and the `Connection`.
169+-- | Run a `PQ` and keep the result and the `Connection`.
170runPQ
170runPQ
171 :: Functor m
171 :: Functor m
172 => PQ schema0 schema1 m x
172 => PQ schema0 schema1 m x
@@ -176,7 +176,7 @@ runPQ (PQ pq) conn = (\ x -> (unK x, K (unK conn))) <$> pq conn
176 -- K x <- pq conn
176 -- K x <- pq conn
177 -- return (x, K (unK conn))
177 -- return (x, K (unK conn))
178
178
179−-- | Execute a `PQ` and discard the result but keep the `Connection`.
179+-- | Execute a `PQ` and discard the result but keep the `Connection`.
180execPQ
180execPQ
181 :: Functor m
181 :: Functor m
182 => PQ schema0 schema1 m x
182 => PQ schema0 schema1 m x
squeal-postgresql/src/Squeal/PostgreSQL/Pool.hs+1−1
@@ -109,7 +109,7 @@ instance MonadBaseControl IO io => MonadPQ schema (PoolPQ schema io) where
109 (_ :: K () schema) <- flip unPQ conn $
109 (_ :: K () schema) <- flip unPQ conn $
110 traversePrepared_ manipulation params
110 traversePrepared_ manipulation params
111 return ()
111 return ()
112− liftPQ m = PoolPQ $ \ pool ->
112+ liftPQ m = PoolPQ $ \ pool ->
113 withResource pool $ \ conn -> do
113 withResource pool $ \ conn -> do
114 (K result :: K result schema) <- flip unPQ conn $
114 (K result :: K result schema) <- flip unPQ conn $
115 liftPQ m
115 liftPQ m
squeal-postgresql/src/Squeal/PostgreSQL/Query.hs+5−5
@@ -112,7 +112,7 @@ let
112 '[]
112 '[]
113 '[ "sum" ::: 'NotNull 'PGint4
113 '[ "sum" ::: 'NotNull 'PGint4
114 , "col1" ::: 'NotNull 'PGint4 ]
114 , "col1" ::: 'NotNull 'PGint4 ]
115− query =
115+ query =
116 select
116 select
117 ((#col1 + #col2) `As` #sum :* #col1 :* Nil)
117 ((#col1 + #col2) `As` #sum :* #col1 :* Nil)
118 ( from (table (#tab `As` #t))
118 ( from (table (#tab `As` #t))
@@ -179,7 +179,7 @@ let
179 query =
179 query =
180 select (sum_ #col2 `As` #sum :* #col1 `As` #col1 :* Nil)
180 select (sum_ #col2 `As` #sum :* #col1 `As` #col1 :* Nil)
181 ( from (table (#tab `As` #table1))
181 ( from (table (#tab `As` #table1))
182− & group (By #col1 :* Nil)
182+ & group (By #col1 :* Nil)
183 & having (#col1 + sum_ #col2 .> 1) )
183 & having (#col1 + sum_ #col2 .> 1) )
184in renderQuery query
184in renderQuery query
185:}
185:}
@@ -281,7 +281,7 @@ newtype Query
281 deriving (GHC.Generic,Show,Eq,Ord,NFData)
281 deriving (GHC.Generic,Show,Eq,Ord,NFData)
282
282
283-- | The results of two queries can be combined using the set operation
283-- | The results of two queries can be combined using the set operation
284−-- `union`. Duplicate rows are eliminated.
284+-- `union`. Duplicate rows are eliminated.
285union
285union
286 :: Query schema params columns
286 :: Query schema params columns
287 -> Query schema params columns
287 -> Query schema params columns
@@ -412,7 +412,7 @@ selectDotStar
412selectDotStar rel relations = UnsafeQuery $
412selectDotStar rel relations = UnsafeQuery $
413 "SELECT" <+> renderAlias rel <> ".*" <+> renderTableExpression relations
413 "SELECT" <+> renderAlias rel <> ".*" <+> renderTableExpression relations
414
414
415−-- | A `selectDistinctDotStar` asks for all the columns of a particular table,
415+-- | A `selectDistinctDotStar` asks for all the columns of a particular table,
416-- and eliminates duplicate rows.
416-- and eliminates duplicate rows.
417selectDistinctDotStar
417selectDistinctDotStar
418 :: Has relation relations columns
418 :: Has relation relations columns
@@ -555,7 +555,7 @@ where_ wh rels = rels {whereClause = wh : whereClause rels}
555group
555group
556 :: SListI bys
556 :: SListI bys
557 => NP (By relations) bys -- ^ grouped columns
557 => NP (By relations) bys -- ^ grouped columns
558− -> TableExpression schema params relations 'Ungrouped
558+ -> TableExpression schema params relations 'Ungrouped
559 -> TableExpression schema params relations ('Grouped bys)
559 -> TableExpression schema params relations ('Grouped bys)
560group bys rels = TableExpression
560group bys rels = TableExpression
561 { fromClause = fromClause rels
561 { fromClause = fromClause rels
squeal-postgresql/src/Squeal/PostgreSQL/Transaction.hs+4−4
@@ -158,22 +158,22 @@ data IsolationLevel
158 = Serializable
158 = Serializable
159 -- ^ Dirty read is not possible.
159 -- ^ Dirty read is not possible.
160 -- Nonrepeatable read is not possible.
160 -- Nonrepeatable read is not possible.
161− -- Phantom read is not possible.
161+ -- Phantom read is not possible.
162 -- Serialization anomaly is not possible.
162 -- Serialization anomaly is not possible.
163 | RepeatableRead
163 | RepeatableRead
164 -- ^ Dirty read is not possible.
164 -- ^ Dirty read is not possible.
165 -- Nonrepeatable read is not possible.
165 -- Nonrepeatable read is not possible.
166− -- Phantom read is not possible.
166+ -- Phantom read is not possible.
167 -- Serialization anomaly is possible.
167 -- Serialization anomaly is possible.
168 | ReadCommitted
168 | ReadCommitted
169 -- ^ Dirty read is not possible.
169 -- ^ Dirty read is not possible.
170 -- Nonrepeatable read is possible.
170 -- Nonrepeatable read is possible.
171− -- Phantom read is possible.
171+ -- Phantom read is possible.
172 -- Serialization anomaly is possible.
172 -- Serialization anomaly is possible.
173 | ReadUncommitted
173 | ReadUncommitted
174 -- ^ Dirty read is not possible.
174 -- ^ Dirty read is not possible.
175 -- Nonrepeatable read is possible.
175 -- Nonrepeatable read is possible.
176− -- Phantom read is possible.
176+ -- Phantom read is possible.
177 -- Serialization anomaly is possible.
177 -- Serialization anomaly is possible.
178 deriving (Show, Eq)
178 deriving (Show, Eq)
179
179