@@ -38,6 +38,7 @@ newtype PoolPQ (schema :: TablesType) m x =
38 PoolPQ { runPoolPQ :: Pool (K Connection schema) -> m x }
38 PoolPQ { runPoolPQ :: Pool (K Connection schema) -> m x }
39 deriving Functor
39 deriving Functor
41+-- | `Applicative` instance for `PoolPQ`.
41instance Monad m => Applicative (PoolPQ schema m) where
42instance Monad m => Applicative (PoolPQ schema m) where
42 pure x = PoolPQ $ \ _ -> pure x
43 pure x = PoolPQ $ \ _ -> pure x
43 PoolPQ f <*> PoolPQ x = PoolPQ $ \ pool -> do
44 PoolPQ f <*> PoolPQ x = PoolPQ $ \ pool -> do
@@ -45,18 +46,22 @@ instance Monad m => Applicative (PoolPQ schema m) where
45 x' <- x pool
46 x' <- x pool
46 return $ f' x'
47 return $ f' x'
49+-- | `Monad` instance for `PoolPQ`.
48instance Monad m => Monad (PoolPQ schema m) where
50instance Monad m => Monad (PoolPQ schema m) where
49 return = pure
51 return = pure
50 PoolPQ x >>= f = PoolPQ $ \ pool -> do
52 PoolPQ x >>= f = PoolPQ $ \ pool -> do
51 x' <- x pool
53 x' <- x pool
52 runPoolPQ (f x') pool
54 runPoolPQ (f x') pool
56+-- | `MonadTrans` instance for `PoolPQ`.
54instance MonadTrans (PoolPQ schema) where
57instance MonadTrans (PoolPQ schema) where
55 lift m = PoolPQ $ \ _pool -> m
58 lift m = PoolPQ $ \ _pool -> m
60+-- | `MonadBase` instance for `PoolPQ`.
57instance MonadBase b m => MonadBase b (PoolPQ schema m) where
61instance MonadBase b m => MonadBase b (PoolPQ schema m) where
58 liftBase = lift . liftBase
62 liftBase = lift . liftBase
64+-- | `MonadPQ` instance for `PoolPQ`.
60instance MonadBaseControl IO io => MonadPQ schema (PoolPQ schema io) where
65instance MonadBaseControl IO io => MonadPQ schema (PoolPQ schema io) where
61 manipulateParams manipulation params = PoolPQ $ \ pool -> do
66 manipulateParams manipulation params = PoolPQ $ \ pool -> do
62 withResource pool $ \ conn -> do
67 withResource pool $ \ conn -> do
@@ -88,6 +93,7 @@ poolpqliftWith :: Functor m => (PoolPQRun schema -> m a) -> PoolPQ schema m a
88poolpqliftWith f = PoolPQ $ \ pool ->
93poolpqliftWith f = PoolPQ $ \ pool ->
89 (f $ \ pq -> runPoolPQ pq pool)
94 (f $ \ pq -> runPoolPQ pq pool)
96+-- | `MonadBaseControl` instance for `PoolPQ`.
91instance MonadBaseControl b m => MonadBaseControl b (PoolPQ schema m) where
97instance MonadBaseControl b m => MonadBaseControl b (PoolPQ schema m) where
92 type StM (PoolPQ schema m) x = StM m x
98 type StM (PoolPQ schema m) x = StM m x
93 liftBaseWith f =
99 liftBaseWith f =