mirror of
https://github.com/nikita-volkov/hasql.git
synced 2024-11-22 10:05:27 +03:00
Clean up
This commit is contained in:
parent
851444711b
commit
b07dc536fe
@ -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 ()
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user