From 1544e3d783ad9514273521965f1b582a20d8edc8 Mon Sep 17 00:00:00 2001 From: Nikita Volkov Date: Mon, 22 Apr 2024 09:52:37 +0300 Subject: [PATCH] Fix --- library/Hasql/Pipeline/Core.hs | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/library/Hasql/Pipeline/Core.hs b/library/Hasql/Pipeline/Core.hs index e73d60a..ba2c37e 100644 --- a/library/Hasql/Pipeline/Core.hs +++ b/library/Hasql/Pipeline/Core.hs @@ -15,12 +15,14 @@ run :: forall a. Pipeline a -> Pq.Connection -> PreparedStatementRegistry.Prepar run (Pipeline sendQueriesInIO) connection registry integerDatetimes = do runExceptT do enterPipelineMode - flip finallyE exitPipelineMode do - recvQueries <- sendQueries - pipelineSync - queriesResult <- recvQueries - recvPipelineSync - pure queriesResult + finallyE + do + recvQueries <- sendQueries + pipelineSync + recvQueries + do + recvPipelineSync + exitPipelineMode where enterPipelineMode :: ExceptT SessionError IO () enterPipelineMode = @@ -40,9 +42,14 @@ run (Pipeline sendQueriesInIO) connection registry integerDatetimes = do recvPipelineSync :: ExceptT SessionError IO () recvPipelineSync = + runResultsDecoder + $ Decoders.Results.single Decoders.Result.pipelineSync + + runResultsDecoder :: forall a. Decoders.Results.Results a -> ExceptT SessionError IO a + runResultsDecoder decoder = ExceptT $ fmap (mapLeft PipelineSessionError) - $ Decoders.Results.run (Decoders.Results.single Decoders.Result.pipelineSync) connection integerDatetimes + $ Decoders.Results.run decoder connection integerDatetimes runCommand :: IO Bool -> ExceptT SessionError IO () runCommand action =