hpqtypes 1.9.1.0 → 1.9.1.1
raw patch · 11 files changed
+30/−23 lines, 11 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Database.PostgreSQL.PQTypes.Internal.Monad: instance (m Data.Type.Equality.~ n, Control.Monad.Base.MonadBase GHC.Types.IO m, Control.Monad.Catch.MonadMask m) => Database.PostgreSQL.PQTypes.Class.MonadDB (Database.PostgreSQL.PQTypes.Internal.Monad.DBT_ m n)
- Database.PostgreSQL.PQTypes.Internal.Monad: instance (m Data.Type.Equality.~ n, Control.Monad.Error.Class.MonadError e m) => Control.Monad.Error.Class.MonadError e (Database.PostgreSQL.PQTypes.Internal.Monad.DBT_ m n)
- Database.PostgreSQL.PQTypes.Internal.Monad: instance (m Data.Type.Equality.~ n, Control.Monad.Reader.Class.MonadReader r m) => Control.Monad.Reader.Class.MonadReader r (Database.PostgreSQL.PQTypes.Internal.Monad.DBT_ m n)
- Database.PostgreSQL.PQTypes.Internal.Monad: instance (m Data.Type.Equality.~ n, Control.Monad.State.Class.MonadState s m) => Control.Monad.State.Class.MonadState s (Database.PostgreSQL.PQTypes.Internal.Monad.DBT_ m n)
- Database.PostgreSQL.PQTypes.Internal.Monad: instance (m Data.Type.Equality.~ n, Control.Monad.Trans.Control.MonadBaseControl b m) => Control.Monad.Trans.Control.MonadBaseControl b (Database.PostgreSQL.PQTypes.Internal.Monad.DBT_ m n)
- Database.PostgreSQL.PQTypes.Internal.Monad: instance (m Data.Type.Equality.~ n, Control.Monad.Writer.Class.MonadWriter w m) => Control.Monad.Writer.Class.MonadWriter w (Database.PostgreSQL.PQTypes.Internal.Monad.DBT_ m n)
+ Database.PostgreSQL.PQTypes.Internal.Monad: instance (m GHC.Types.~ n, Control.Monad.Base.MonadBase GHC.Types.IO m, Control.Monad.Catch.MonadMask m) => Database.PostgreSQL.PQTypes.Class.MonadDB (Database.PostgreSQL.PQTypes.Internal.Monad.DBT_ m n)
+ Database.PostgreSQL.PQTypes.Internal.Monad: instance (m GHC.Types.~ n, Control.Monad.Error.Class.MonadError e m) => Control.Monad.Error.Class.MonadError e (Database.PostgreSQL.PQTypes.Internal.Monad.DBT_ m n)
+ Database.PostgreSQL.PQTypes.Internal.Monad: instance (m GHC.Types.~ n, Control.Monad.Reader.Class.MonadReader r m) => Control.Monad.Reader.Class.MonadReader r (Database.PostgreSQL.PQTypes.Internal.Monad.DBT_ m n)
+ Database.PostgreSQL.PQTypes.Internal.Monad: instance (m GHC.Types.~ n, Control.Monad.State.Class.MonadState s m) => Control.Monad.State.Class.MonadState s (Database.PostgreSQL.PQTypes.Internal.Monad.DBT_ m n)
+ Database.PostgreSQL.PQTypes.Internal.Monad: instance (m GHC.Types.~ n, Control.Monad.Trans.Control.MonadBaseControl b m) => Control.Monad.Trans.Control.MonadBaseControl b (Database.PostgreSQL.PQTypes.Internal.Monad.DBT_ m n)
+ Database.PostgreSQL.PQTypes.Internal.Monad: instance (m GHC.Types.~ n, Control.Monad.Writer.Class.MonadWriter w m) => Control.Monad.Writer.Class.MonadWriter w (Database.PostgreSQL.PQTypes.Internal.Monad.DBT_ m n)
- Database.PostgreSQL.PQTypes: ConnectionSource :: (forall m. MkConstraint m cs => ConnectionSourceM m) -> ConnectionSource
+ Database.PostgreSQL.PQTypes: ConnectionSource :: (forall m. MkConstraint m cs => ConnectionSourceM m) -> ConnectionSource (cs :: [(Type -> Type) -> Constraint])
- Database.PostgreSQL.PQTypes: [unConnectionSource] :: ConnectionSource -> forall m. MkConstraint m cs => ConnectionSourceM m
+ Database.PostgreSQL.PQTypes: [unConnectionSource] :: ConnectionSource (cs :: [(Type -> Type) -> Constraint]) -> forall m. MkConstraint m cs => ConnectionSourceM m
- Database.PostgreSQL.PQTypes: newtype ConnectionSource (cs :: [(* -> *) -> Constraint])
+ Database.PostgreSQL.PQTypes: newtype ConnectionSource (cs :: [(Type -> Type) -> Constraint])
- Database.PostgreSQL.PQTypes.Composite: type family CompositeRow t :: *
+ Database.PostgreSQL.PQTypes.Composite: type family CompositeRow t :: Type
- Database.PostgreSQL.PQTypes.FromSQL: type family PQBase t :: *;
+ Database.PostgreSQL.PQTypes.FromSQL: type family PQBase t :: Type;
- Database.PostgreSQL.PQTypes.Internal.Connection: ConnectionSource :: (forall m. MkConstraint m cs => ConnectionSourceM m) -> ConnectionSource
+ Database.PostgreSQL.PQTypes.Internal.Connection: ConnectionSource :: (forall m. MkConstraint m cs => ConnectionSourceM m) -> ConnectionSource (cs :: [(Type -> Type) -> Constraint])
- Database.PostgreSQL.PQTypes.Internal.Connection: [unConnectionSource] :: ConnectionSource -> forall m. MkConstraint m cs => ConnectionSourceM m
+ Database.PostgreSQL.PQTypes.Internal.Connection: [unConnectionSource] :: ConnectionSource (cs :: [(Type -> Type) -> Constraint]) -> forall m. MkConstraint m cs => ConnectionSourceM m
- Database.PostgreSQL.PQTypes.Internal.Connection: newtype ConnectionSource (cs :: [(* -> *) -> Constraint])
+ Database.PostgreSQL.PQTypes.Internal.Connection: newtype ConnectionSource (cs :: [(Type -> Type) -> Constraint])
- Database.PostgreSQL.PQTypes.Internal.Utils: type family MkConstraint (m :: * -> *) (cs :: [(* -> *) -> Constraint]) :: Constraint
+ Database.PostgreSQL.PQTypes.Internal.Utils: type family MkConstraint (m :: Type -> Type) (cs :: [(Type -> Type) -> Constraint]) :: Constraint
- Database.PostgreSQL.PQTypes.ToSQL: type family PQDest t :: *;
+ Database.PostgreSQL.PQTypes.ToSQL: type family PQDest t :: Type;
Files
- CHANGELOG.md +3/−0
- hpqtypes.cabal +4/−3
- src/Database/PostgreSQL/PQTypes/Composite.hs +2/−1
- src/Database/PostgreSQL/PQTypes/Cursor.hs +5/−4
- src/Database/PostgreSQL/PQTypes/FromSQL.hs +2/−1
- src/Database/PostgreSQL/PQTypes/Internal/Connection.hs +2/−1
- src/Database/PostgreSQL/PQTypes/Internal/Monad.hs +1/−1
- src/Database/PostgreSQL/PQTypes/Internal/Utils.hs +3/−1
- src/Database/PostgreSQL/PQTypes/SQL.hs +1/−1
- src/Database/PostgreSQL/PQTypes/ToSQL.hs +2/−1
- test/Main.hs +5/−9
CHANGELOG.md view
@@ -1,3 +1,6 @@+# hpqtypes-1.9.1.1 (2021-05-27)+* Support GHC 9.0.+ # hpqtypes-1.9.1.0 (2020-09-14) * Expose aesonFromSQL and aesonToSQL for convenience.
hpqtypes.cabal view
@@ -1,5 +1,5 @@ name: hpqtypes-version: 1.9.1.0+version: 1.9.1.1 synopsis: Haskell bindings to libpqtypes description: Efficient and easy-to-use bindings to (slightly modified)@@ -39,7 +39,8 @@ category: Database build-type: Custom cabal-version: 1.24-tested-with: GHC ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.2+tested-with: GHC ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.4+ || ==9.0.1 extra-source-files: README.md@@ -71,7 +72,7 @@ custom-setup setup-depends: base >= 4.9 && < 5,- Cabal >= 1.24 && < 3.3,+ Cabal >= 1.24 && < 3.6, directory, filepath
src/Database/PostgreSQL/PQTypes/Composite.hs view
@@ -7,6 +7,7 @@ , CompositeToSQL(..) ) where +import Data.Kind (Type) import Foreign.Ptr import qualified Control.Exception as E @@ -34,7 +35,7 @@ -- As an example, consider the type defined as (a INTEGER, b DATE). -- Then its CompositeRow instance could be (Maybe Int32, Maybe Day), -- (Maybe Int32, Day), (Int32, Maybe Day) or (Int32, Day).-type family CompositeRow t :: *+type family CompositeRow t :: Type -- | Class which represents \"from SQL to composite\" transformation. class (PQFormat t, FromRow (CompositeRow t)) => CompositeFromSQL t where
src/Database/PostgreSQL/PQTypes/Cursor.hs view
@@ -43,10 +43,11 @@ deriving (Eq, Ord, Show) -- | Defines whether a cursor will be declared as @WITH HOLD@ or @WITHOUT HOLD@.--- Cursors declared as @WITH HOLD@ can only be declared within a transaction--- block and they're automatically closed once the transaction finishes,--- otherwise they're independent of the current transaction and can be declared--- even if no transaction is active.+--+-- From the PostgreSQL manual: WITH HOLD specifies that the cursor can continue+-- to be used after the transaction that created it successfully commits.+-- WITHOUT HOLD specifies that the cursor cannot be used outside of the+-- transaction that created it. data Hold = Hold | NoHold deriving (Eq, Ord, Show)
src/Database/PostgreSQL/PQTypes/FromSQL.hs view
@@ -3,6 +3,7 @@ ) where import Data.Int+import Data.Kind (Type) import Data.Ratio import Data.Text.Encoding import Data.Time@@ -24,7 +25,7 @@ -- type to Haskell type\" transformation. class (PQFormat t, Storable (PQBase t)) => FromSQL t where -- | Base type (used by libpqtypes).- type PQBase t :: *+ type PQBase t :: Type -- | Convert value of base type to target one. fromSQL :: Maybe (PQBase t) -- ^ base value (Nothing if NULL was delivered) -> IO t
src/Database/PostgreSQL/PQTypes/Internal/Connection.hs view
@@ -20,6 +20,7 @@ import Control.Monad.Base import Control.Monad.Catch import Data.Function+import Data.Kind (Type) import Data.Pool import Data.Time.Clock import Foreign.C.String@@ -114,7 +115,7 @@ } -- | Wrapper for a polymorphic connection source.-newtype ConnectionSource (cs :: [(* -> *) -> Constraint]) = ConnectionSource {+newtype ConnectionSource (cs :: [(Type -> Type) -> Constraint]) = ConnectionSource { unConnectionSource :: forall m. MkConstraint m cs => ConnectionSourceM m }
src/Database/PostgreSQL/PQTypes/Internal/Monad.hs view
@@ -82,7 +82,7 @@ Nothing -> throwDB $ HPQTypesError "getConnectionStats: no connection" Just cd -> return $ cdStats cd - getQueryResult = DBT . gets $ dbQueryResult+ getQueryResult = DBT . gets $ \st -> dbQueryResult st clearQueryResult = DBT . modify $ \st -> st { dbQueryResult = Nothing } getTransactionSettings = DBT . gets $ dbTransactionSettings
src/Database/PostgreSQL/PQTypes/Internal/Utils.hs view
@@ -17,6 +17,7 @@ import Control.Monad import Data.ByteString.Unsafe+import Data.Kind (Type) import Foreign.C import Foreign.ForeignPtr import Foreign.Marshal.Alloc@@ -32,7 +33,8 @@ import Database.PostgreSQL.PQTypes.Internal.C.Types import Database.PostgreSQL.PQTypes.Internal.Error -type family MkConstraint (m :: * -> *) (cs :: [(* -> *) -> Constraint]) :: Constraint where+type family MkConstraint (m :: Type -> Type)+ (cs :: [(Type -> Type) -> Constraint]) :: Constraint where MkConstraint m '[] = () MkConstraint m (c ': cs) = (c m, MkConstraint m cs)
src/Database/PostgreSQL/PQTypes/SQL.hs view
@@ -73,7 +73,7 @@ ---------------------------------------- --- | Convert 'ByteString' to 'SQL'.+-- | Convert a 'Text' SQL string to the 'SQL' type. mkSQL :: T.Text -> SQL mkSQL = SQL . S.singleton . SqlString
src/Database/PostgreSQL/PQTypes/ToSQL.hs view
@@ -6,6 +6,7 @@ import Data.ByteString.Unsafe import Data.Int+import Data.Kind (Type) import Data.Text.Encoding import Data.Time import Data.Word@@ -31,7 +32,7 @@ -- to SQL (libpqtypes) type\" transformation. class PQFormat t => ToSQL t where -- | Destination type (used by libpqtypes).- type PQDest t :: *+ type PQDest t :: Type -- | Put supplied value into inner 'PGparam'. toSQL :: t -- ^ Value to be put. -> ParamAllocator -- ^ 'PGparam' allocator.
test/Main.hs view
@@ -617,15 +617,11 @@ runSQL_ "DROP TABLE test1_" getConnString :: IO (T.Text, [String])-getConnString = do- args <- getArgs- if (null args) then- do isTravis <- maybe False ((==) "true") <$> lookupEnv "TRAVIS"- if isTravis- then return ("postgresql://postgres@localhost/travis_ci_test", [])- else do printUsage- exitFailure- else return $ (T.pack . head $ args, tail args)+getConnString = getArgs >>= \case+ connString : args -> return (T.pack connString, args)+ [] -> lookupEnv "GITHUB_ACTIONS" >>= \case+ Just "true" -> return ("host=postgres user=postgres password=postgres", [])+ _ -> printUsage >> exitFailure where printUsage = do prog <- getProgName