@@ -6,7 +6,7 @@ Maintainer: eitan@morphism.tech
6Stability: experimental
6Stability: experimental
8This module is where Squeal commands actually get executed by
8This module is where Squeal commands actually get executed by
9−`LibPQ`. It containts two typeclasses, `IndexedMonadTransPQ` for executing
9+`Database.PostgreSQL.LibPQ`. It containts two typeclasses, `IndexedMonadTransPQ` for executing
10a `Definition` and `MonadPQ` for executing a `Manipulation` or `Query`,
10a `Definition` and `MonadPQ` for executing a `Manipulation` or `Query`,
11and a `PQ` type with instances for them.
11and a `PQ` type with instances for them.
@@ -172,7 +172,7 @@ instance Monad m => Functor (PQ schemas0 schemas1 m) where
172 K x <- pq conn
172 K x <- pq conn
173 return $ K (f x)
173 return $ K (f x)
175−-- | Run a `PQ` and keep the result and the `Connection`.
175+-- | Run a `PQ` and keep the result and the `LibPQ.Connection`.
177 :: Functor m
177 :: Functor m
178 => PQ schemas0 schemas1 m x
178 => PQ schemas0 schemas1 m x
@@ -182,7 +182,7 @@ runPQ (PQ pq) conn = (\ x -> (unK x, K (unK conn))) <$> pq conn
182 -- K x <- pq conn
182 -- K x <- pq conn
183 -- return (x, K (unK conn))
183 -- return (x, K (unK conn))
185−-- | Execute a `PQ` and discard the result but keep the `Connection`.
185+-- | Execute a `PQ` and discard the result but keep the `LibPQ.Connection`.
187 :: Functor m
187 :: Functor m
188 => PQ schemas0 schemas1 m x
188 => PQ schemas0 schemas1 m x
@@ -190,7 +190,7 @@ execPQ
190 -> m (K LibPQ.Connection schemas1)
190 -> m (K LibPQ.Connection schemas1)
191execPQ (PQ pq) conn = mapKK (\ _ -> unK conn) <$> pq conn
191execPQ (PQ pq) conn = mapKK (\ _ -> unK conn) <$> pq conn
193−-- | Evaluate a `PQ` and discard the `Connection` but keep the result.
193+-- | Evaluate a `PQ` and discard the `LibPQ.Connection` but keep the result.
195 :: Functor m
195 :: Functor m
196 => PQ schemas0 schemas1 m x
196 => PQ schemas0 schemas1 m x
@@ -279,8 +279,8 @@ instance IndexedMonadTransPQ PQ where
279 "define: LibPQ.exec returned no results"
279 "define: LibPQ.exec returned no results"
280 Just result -> return $ K (K result)
280 Just result -> return $ K (K result)
282−{- | `MonadPQ` is an `mtl` style constraint, similar to
282+{- | `MonadPQ` is an @mtl@ style constraint, similar to
283−`Control.Monad.State.Class.MonadState`, for using `LibPQ` to
283+`Control.Monad.State.Class.MonadState`, for using `Database.PostgreSQL.LibPQ` to
285* `manipulateParams` runs a `Manipulation` with params from a type
285* `manipulateParams` runs a `Manipulation` with params from a type
286 with a `ToParams` constraint. It calls `LibPQ.execParams` and
286 with a `ToParams` constraint. It calls `LibPQ.execParams` and
@@ -305,7 +305,7 @@ instance IndexedMonadTransPQ PQ where
306* `forPrepared_` is a flipped `traversePrepared_`.
306* `forPrepared_` is a flipped `traversePrepared_`.
308−* `liftPQ` lets you lift actions from `LibPQ` that require a connection
308+* `liftPQ` lets you lift actions from `Database.PostgreSQL.LibPQ` that require a connection
309 into your monad.
309 into your monad.
311To define an instance, you can minimally define only `manipulateParams`,
311To define an instance, you can minimally define only `manipulateParams`,
@@ -317,13 +317,13 @@ class Monad pq => MonadPQ schemas pq | pq -> schemas where
317 manipulateParams
317 manipulateParams
318 :: ToParams x params
318 :: ToParams x params
319 => Manipulation '[] schemas params ys
319 => Manipulation '[] schemas params ys
320− -- ^ `insertRows`, `update` or `deleteFrom`
320+ -- ^ `insertInto`, `update` or `deleteFrom`
321 -> x -> pq (K LibPQ.Result ys)
321 -> x -> pq (K LibPQ.Result ys)
322 default manipulateParams
322 default manipulateParams
323 :: (MonadTrans t, MonadPQ schemas pq1, pq ~ t pq1)
323 :: (MonadTrans t, MonadPQ schemas pq1, pq ~ t pq1)
324 => ToParams x params
324 => ToParams x params
325 => Manipulation '[] schemas params ys
325 => Manipulation '[] schemas params ys
326− -- ^ `insertRows`, `update` or `deleteFrom`
326+ -- ^ `insertInto`, `update` or `deleteFrom`
327 -> x -> pq (K LibPQ.Result ys)
327 -> x -> pq (K LibPQ.Result ys)
328 manipulateParams manipulation params = lift $
328 manipulateParams manipulation params = lift $
329 manipulateParams manipulation params
329 manipulateParams manipulation params
@@ -347,7 +347,7 @@ class Monad pq => MonadPQ schemas pq | pq -> schemas where
347 traversePrepared
347 traversePrepared
348 :: (ToParams x params, Traversable list)
348 :: (ToParams x params, Traversable list)
349 => Manipulation '[] schemas params ys
349 => Manipulation '[] schemas params ys
350− -- ^ `insertRows`, `update`, or `deleteFrom`, and friends
350+ -- ^ `insertInto`, `update`, or `deleteFrom`, and friends
351 -> list x -> pq (list (K LibPQ.Result ys))
351 -> list x -> pq (list (K LibPQ.Result ys))
352 default traversePrepared
352 default traversePrepared
353 :: (MonadTrans t, MonadPQ schemas pq1, pq ~ t pq1)
353 :: (MonadTrans t, MonadPQ schemas pq1, pq ~ t pq1)
@@ -360,20 +360,20 @@ class Monad pq => MonadPQ schemas pq | pq -> schemas where
360 :: (ToParams x params, Traversable list)
360 :: (ToParams x params, Traversable list)
361 => list x
361 => list x
362 -> Manipulation '[] schemas params ys
362 -> Manipulation '[] schemas params ys
363− -- ^ `insertRows`, `update` or `deleteFrom`
363+ -- ^ `insertInto`, `update` or `deleteFrom`
364 -> pq (list (K LibPQ.Result ys))
364 -> pq (list (K LibPQ.Result ys))
365 forPrepared = flip traversePrepared
365 forPrepared = flip traversePrepared
367 traversePrepared_
367 traversePrepared_
368 :: (ToParams x params, Foldable list)
368 :: (ToParams x params, Foldable list)
369 => Manipulation '[] schemas params '[]
369 => Manipulation '[] schemas params '[]
370− -- ^ `insertRows`, `update` or `deleteFrom`
370+ -- ^ `insertInto`, `update` or `deleteFrom`
371 -> list x -> pq ()
371 -> list x -> pq ()
372 default traversePrepared_
372 default traversePrepared_
373 :: (MonadTrans t, MonadPQ schemas pq1, pq ~ t pq1)
373 :: (MonadTrans t, MonadPQ schemas pq1, pq ~ t pq1)
374 => (ToParams x params, Foldable list)
374 => (ToParams x params, Foldable list)
375 => Manipulation '[] schemas params '[]
375 => Manipulation '[] schemas params '[]
376− -- ^ `insertRows`, `update` or `deleteFrom`
376+ -- ^ `insertInto`, `update` or `deleteFrom`
377 -> list x -> pq ()
377 -> list x -> pq ()
378 traversePrepared_ manipulation params = lift $
378 traversePrepared_ manipulation params = lift $
379 traversePrepared_ manipulation params
379 traversePrepared_ manipulation params
@@ -382,7 +382,7 @@ class Monad pq => MonadPQ schemas pq | pq -> schemas where
382 :: (ToParams x params, Foldable list)
382 :: (ToParams x params, Foldable list)
383 => list x
383 => list x
384 -> Manipulation '[] schemas params '[]
384 -> Manipulation '[] schemas params '[]
385− -- ^ `insertRows`, `update` or `deleteFrom`
385+ -- ^ `insertInto`, `update` or `deleteFrom`
387 forPrepared_ = flip traversePrepared_
387 forPrepared_ = flip traversePrepared_