From 901e931af48a43c7ce32d9ccecd3f7321f91b9eb Mon Sep 17 00:00:00 2001 From: Orion Kindel Date: Tue, 25 Jun 2024 16:02:15 -0500 Subject: [PATCH] fix: more relaxation --- src/Control.Monad.Postgres.Base.purs | 3 +-- src/Control.Monad.Postgres.Session.purs | 3 ++- src/Effect.Postgres.Error.RE.purs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Control.Monad.Postgres.Base.purs b/src/Control.Monad.Postgres.Base.purs index 05e98ea..1ae4679 100644 --- a/src/Control.Monad.Postgres.Base.purs +++ b/src/Control.Monad.Postgres.Base.purs @@ -71,8 +71,7 @@ class (Monad m, MonadSession session, MonadCursor cursor ct) <= MonadPostgres m cursorWith :: forall q. AsQuery q => (Array Raw -> RepT ct) -> String -> q -> cursor ~> m instance - ( MonadBracket Effect.Error f m - , MonadAff m + ( MonadAff m , MonadSession (SessionT m) , MonadCursor (CursorT t (SessionT m)) t ) => MonadPostgres diff --git a/src/Control.Monad.Postgres.Session.purs b/src/Control.Monad.Postgres.Session.purs index a0ac59b..8ae24f4 100644 --- a/src/Control.Monad.Postgres.Session.purs +++ b/src/Control.Monad.Postgres.Session.purs @@ -17,6 +17,7 @@ import Effect.Aff.Postgres.Client (Client) import Effect.Aff.Postgres.Client as Client import Effect.Aff.Postgres.Pool (Pool) import Effect.Aff.Postgres.Pool as Pool +import Effect.Aff.Unlift (class MonadUnliftAff) import Effect.Class (class MonadEffect, liftEffect) import Effect.Exception as Effect import Effect.Postgres.Error (RE) @@ -70,7 +71,7 @@ class MonadAff m <= MonadSession m where -- | ``` streamOut :: String -> m (Readable ()) -instance (MonadStartSession s, MonadBracket Effect.Error f m, MonadAff m) => MonadSession (RE s m) where +instance (MonadStartSession s, MonadAff m) => MonadSession (RE s m) where query q = do pool <- ask client <- hoist liftAff $ RE.liftExcept $ startSession pool diff --git a/src/Effect.Postgres.Error.RE.purs b/src/Effect.Postgres.Error.RE.purs index e0549af..15d67a9 100644 --- a/src/Effect.Postgres.Error.RE.purs +++ b/src/Effect.Postgres.Error.RE.purs @@ -34,7 +34,7 @@ newtype RE r m a = RE (ReaderT r (ExceptT E m) a) newtype ParRE r f a = ParRE (ReaderT r (Compose f (Either E)) a) -finally :: forall r f m a. MonadBracket Effect.Error f m => RE r m Unit -> RE r m a -> RE r m a +finally :: forall r m a. Monad m => RE r m Unit -> RE r m a -> RE r m a finally after m = (m <* after) `catchError` \e -> after *> throwError e run :: forall m r a. MonadThrow Effect.Error m => RE r m a -> r -> m a