This commit is contained in:
Nikita Volkov 2024-04-21 08:59:15 +03:00
parent 851444711b
commit b07dc536fe
2 changed files with 5 additions and 5 deletions

View File

@ -15,9 +15,9 @@ newtype Result a
deriving (Functor, Applicative, Monad)
{-# INLINE run #-}
run :: Result a -> (Bool, LibPQ.Result) -> IO (Either ResultError a)
run (Result reader) env =
runExceptT (runReaderT reader env)
run :: Result a -> Bool -> LibPQ.Result -> IO (Either ResultError a)
run (Result reader) idt result =
runExceptT (runReaderT reader (idt, result))
{-# INLINE noResult #-}
noResult :: Result ()

View File

@ -45,7 +45,7 @@ single resultDec =
resultMaybe <- LibPQ.getResult connection
case resultMaybe of
Just result ->
mapLeft ResultError <$> Result.run resultDec (integerDatetimes, result)
mapLeft ResultError <$> Result.run resultDec integerDatetimes result
Nothing ->
fmap (Left . ClientError) (LibPQ.errorMessage connection)
@ -84,7 +84,7 @@ dropRemainders =
loop integerDatetimes connection <* checkErrors
where
checkErrors =
ExceptT $ fmap (mapLeft ResultError) $ Result.run Result.noResult (integerDatetimes, result)
ExceptT $ fmap (mapLeft ResultError) $ Result.run Result.noResult integerDatetimes result
refine :: (a -> Either Text b) -> Results a -> Results b
refine refiner (Results stack) = Results