@@ -196,12 +196,6 @@ evalPQ (PQ pq) conn = unK <$> pq conn
196196-- in a larger schema using `pqEmbed`.
197197class IndexedMonadTransPQ pq where
198198
199− -- | Safely embed a computation in a larger schema.
200− pqEmbed
201− :: Monad m
202− => pq schema0 schema1 m x
203− -> pq (table ': schema0) (table : schema1) m x
204−
205199 -- | indexed analog of `<*>`
206200 pqAp
207201 :: Monad m
@@ -229,6 +223,12 @@ class IndexedMonadTransPQ pq where
229223 -> pq schema0 schema1 m x
230224 -> pq schema0 schema2 m y
231225
226+ -- | Safely embed a computation in a larger schema.
227+ pqEmbed
228+ :: Monad m
229+ => pq schema0 schema1 m x
230+ -> pq (table ': schema0) (table : schema1) m x
231+
232232 -- | Run a `Definition` with `LibPQ.exec`, we expect that libpq obeys the law
233233 --
234234 -- @define statement1 & pqThen (define statement2) = define (statement1 >>> statement2)@
@@ -239,10 +239,6 @@ class IndexedMonadTransPQ pq where
239239
240240instance IndexedMonadTransPQ PQ where
241241
242− pqEmbed (PQ pq) = PQ $ \ (K conn) -> do
243− K x <- pq (K conn)
244− return $ K x
245−
246242 pqAp (PQ f) (PQ x) = PQ $ \ conn -> do
247243 K f' <- f conn
248244 K x' <- x (K (unK conn))
@@ -256,6 +252,10 @@ instance IndexedMonadTransPQ PQ where
256252
257253 pqThen pq2 pq1 = pq1 & pqBind (\ _ -> pq2)
258254
255+ pqEmbed (PQ pq) = PQ $ \ (K conn) -> do
256+ K x <- pq (K conn)
257+ return $ K x
258+
259259 define (UnsafeDefinition q) = PQ $ \ (K conn) -> do
260260 resultMaybe <- liftBase $ LibPQ.exec conn q
261261 case resultMaybe of