on dev help sign in
haddock fixes
91a5653Eitan Chatav
squeal-postgresql/src/Squeal/PostgreSQL.hs+2−2
@@ -13,7 +13,7 @@ features.
13
13
14>>> :set -XDataKinds -XDeriveGeneric -XOverloadedLabels
14>>> :set -XDataKinds -XDeriveGeneric -XOverloadedLabels
15>>> :set -XOverloadedStrings -XTypeApplications -XTypeOperators -XGADTs
15>>> :set -XOverloadedStrings -XTypeApplications -XTypeOperators -XGADTs
16−
16+
17We'll need some imports.
17We'll need some imports.
18
18
19>>> import Control.Monad (void)
19>>> import Control.Monad (void)
@@ -105,7 +105,7 @@ DROP TABLE "emails";
105DROP TABLE "users";
105DROP TABLE "users";
106
106
107Next, we'll write `Manipulation`s to insert data into our two tables.
107Next, we'll write `Manipulation`s to insert data into our two tables.
108−A `Manipulation` like `insertRow`, `update` or `deleteFrom`
108+A `Manipulation` like `insertInto`, `update` or `deleteFrom`
109has three type parameters, the schema it refers to, a list of parameters
109has three type parameters, the schema it refers to, a list of parameters
110it can take as input, and a list of columns it produces as output. When
110it can take as input, and a list of columns it produces as output. When
111we insert into the users table, we will need a parameter for the @name@
111we insert into the users table, we will need a parameter for the @name@
squeal-postgresql/src/Squeal/PostgreSQL/Binary.hs+1−1
@@ -47,7 +47,7 @@ void . withConnection "host=localhost port=5432 dbname=exampledb" $ do
47True
47True
48
48
49In addition to being able to encode and decode basic Haskell types
49In addition to being able to encode and decode basic Haskell types
50−like `Int16` and `Text`, Squeal permits you to encode and decode Haskell types to
50+like `Int16` and `Data.Text.Text`, Squeal permits you to encode and decode Haskell types to
51Postgres array, enumerated and composite types and json. Let's see another example,
51Postgres array, enumerated and composite types and json. Let's see another example,
52this time using the `Vector` type which corresponds to variable length arrays
52this time using the `Vector` type which corresponds to variable length arrays
53and homogeneous tuples which correspond to fixed length arrays. We can even
53and homogeneous tuples which correspond to fixed length arrays. We can even
squeal-postgresql/src/Squeal/PostgreSQL/PQ.hs+14−14
@@ -6,7 +6,7 @@ Maintainer: eitan@morphism.tech
6Stability: experimental
6Stability: experimental
7
7
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.
12
12
@@ -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)
174
174
175−-- | Run a `PQ` and keep the result and the `Connection`.
175+-- | Run a `PQ` and keep the result and the `LibPQ.Connection`.
176runPQ
176runPQ
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))
184
184
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`.
186execPQ
186execPQ
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
192
192
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.
194evalPQ
194evalPQ
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)
281
281
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
284
284
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
305
305
306* `forPrepared_` is a flipped `traversePrepared_`.
306* `forPrepared_` is a flipped `traversePrepared_`.
307
307
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.
310
310
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
366
366
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`
386 -> pq ()
386 -> pq ()
387 forPrepared_ = flip traversePrepared_
387 forPrepared_ = flip traversePrepared_
388
388
squeal-postgresql/src/Squeal/PostgreSQL/Pool.hs+1−1
@@ -107,7 +107,7 @@ instance Monad m => Monad (PoolPQ schemas m) where
107 x' <- x pool
107 x' <- x pool
108 runPoolPQ (f x') pool
108 runPoolPQ (f x') pool
109
109
110−-- | `MonadFail` instance for `PoolPQ`.
110+-- | `Fail.MonadFail` instance for `PoolPQ`.
111instance Monad m => Fail.MonadFail (PoolPQ schemas m) where
111instance Monad m => Fail.MonadFail (PoolPQ schemas m) where
112 fail = Fail.fail
112 fail = Fail.fail
113
113
squeal-postgresql/src/Squeal/PostgreSQL/Schema.hs+1−1
@@ -289,7 +289,7 @@ type family Uniquely
289type TableType = (TableConstraints,ColumnsType)
289type TableType = (TableConstraints,ColumnsType)
290
290
291{- | A `RowType` is a row of `NullityType`. They correspond to Haskell
291{- | A `RowType` is a row of `NullityType`. They correspond to Haskell
292−record types by means of `RowPG` and are used in many places.
292+record types by means of `Squeal.PostgreSQL.Binary.RowPG` and are used in many places.
293
293
294>>> :{
294>>> :{
295type family PersonRow :: RowType where
295type family PersonRow :: RowType where
squeal-postgresql/src/Squeal/PostgreSQL/Transaction.hs+1−1
@@ -92,7 +92,7 @@ transactionallySchema mode u = PQ $ \ conn -> mask $ \ restore -> do
92 _ <- liftBase $ LibPQ.exec (unK conn) "COMMIT"
92 _ <- liftBase $ LibPQ.exec (unK conn) "COMMIT"
93 return x
93 return x
94
94
95−-- | Run a schema changing computation `transactionallySchema_` in `DefaultMode`.
95+-- | Run a schema changing computation `transactionallySchema_` in `defaultMode`.
96transactionallySchema_
96transactionallySchema_
97 :: MonadBaseControl IO io
97 :: MonadBaseControl IO io
98 => PQ schemas0 schemas1 io x
98 => PQ schemas0 schemas1 io x