on dev help sign in
docs
dcfd5bbEitan Chatav
squeal-postgresql/src/Squeal/PostgreSQL/Definition.hs+1
@@ -336,6 +336,7 @@ foreignKey columns reftable refcolumns onDelete onUpdate =
336 <+> renderOnDeleteClause onDelete
336 <+> renderOnDeleteClause onDelete
337 <+> renderOnUpdateClause onUpdate
337 <+> renderOnUpdateClause onUpdate
338
338
339+-- | A type synonym for constraints on a table with a foreign key.
339type ForeignKeyed schema table reftable subcolumns refsubcolumns
340type ForeignKeyed schema table reftable subcolumns refsubcolumns
340 = ( Has table schema reftable
341 = ( Has table schema reftable
341 , SameTypes subcolumns refsubcolumns
342 , SameTypes subcolumns refsubcolumns
squeal-postgresql/src/Squeal/PostgreSQL/Pool.hs+6
@@ -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
40
40
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'
47
48
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
53
55
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
56
59
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
59
63
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)
90
95
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 =