hasql 1.4.2 → 1.4.3
raw patch · 5 files changed
+13/−14 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- hasql.cabal +1/−1
- library/Hasql/Private/Decoders.hs +2/−2
- library/Hasql/Private/Decoders/Result.hs +2/−2
- library/Hasql/Private/Decoders/Row.hs +8/−3
- tasty/Main/Prelude.hs +0/−6
hasql.cabal view
@@ -1,5 +1,5 @@ name: hasql-version: 1.4.2+version: 1.4.3 category: Hasql, Database, PostgreSQL synopsis: An efficient PostgreSQL driver with a flexible mapping API description:
library/Hasql/Private/Decoders.hs view
@@ -113,7 +113,7 @@ @ -} newtype Row a = Row (Row.Row a)- deriving (Functor, Applicative, Monad)+ deriving (Functor, Applicative, Monad, MonadFail) {-| Lift an individual non-nullable value decoder to a composable row decoder.@@ -268,7 +268,7 @@ {-| Decoder of the @TIMETZ@ values. -Unlike in case of @TIMESTAMPTZ@, +Unlike in case of @TIMESTAMPTZ@, Postgres does store the timezone information for @TIMETZ@. However the Haskell's \"time\" library does not contain any composite type, that fits the task, so we use a pair of 'TimeOfDay' and 'TimeZone'
library/Hasql/Private/Decoders/Result.hs view
@@ -69,10 +69,10 @@ serverError = Result $ ReaderT $ \(_, result) -> ExceptT $ do code <- - fmap (fromMaybe ($bug "No code")) $+ fmap fold $ LibPQ.resultErrorField result LibPQ.DiagSqlstate message <- - fmap (fromMaybe ($bug "No message")) $+ fmap fold $ LibPQ.resultErrorField result LibPQ.DiagMessagePrimary detail <- LibPQ.resultErrorField result LibPQ.DiagMessageDetail
library/Hasql/Private/Decoders/Row.hs view
@@ -3,14 +3,19 @@ import Hasql.Private.Prelude hiding (error) import Hasql.Private.Errors import qualified Database.PostgreSQL.LibPQ as LibPQ+import qualified Data.Text as T import qualified PostgreSQL.Binary.Decoding as A import qualified Hasql.Private.Decoders.Value as Value+import Control.Monad.Fail (MonadFail(..)) newtype Row a = Row (ReaderT Env (ExceptT RowError IO) a) deriving (Functor, Applicative, Monad) +instance MonadFail Row where+ fail = error . ValueError . T.pack+ data Env = Env !LibPQ.Result !LibPQ.Row !LibPQ.Column !Bool !(IORef LibPQ.Column) @@ -35,14 +40,14 @@ {-# INLINE value #-} value :: Value.Value a -> Row (Maybe a) value valueDec =- {-# SCC "value" #-} + {-# SCC "value" #-} Row $ ReaderT $ \(Env result row columnsAmount integerDatetimes columnRef) -> ExceptT $ do col <- readIORef columnRef writeIORef columnRef (succ col) if col < columnsAmount then do valueMaybe <- {-# SCC "getvalue'" #-} LibPQ.getvalue' result row col- pure $ + pure $ case valueMaybe of Nothing -> Right Nothing@@ -56,5 +61,5 @@ {-# INLINE nonNullValue #-} nonNullValue :: Value.Value a -> Row a nonNullValue valueDec =- {-# SCC "nonNullValue" #-} + {-# SCC "nonNullValue" #-} value valueDec >>= maybe (error UnexpectedNull) pure
tasty/Main/Prelude.hs view
@@ -1,7 +1,6 @@ module Main.Prelude ( module Exports,- mapLeft, ) where @@ -9,8 +8,3 @@ -- rerebase ------------------------- import Prelude as Exports--{-# INLINE mapLeft #-}-mapLeft :: (a -> c) -> Either a b -> Either c b-mapLeft f =- either (Left . f) Right