hpqtypes 1.2.4 → 1.2.5
raw patch · 3 files changed
+26/−3 lines, 3 filesnew-uploaderPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- hpqtypes.cabal +1/−1
- src/Database/PostgreSQL/PQTypes/Internal/Monad.hs +17/−1
- test/Main.hs +8/−1
hpqtypes.cabal view
@@ -1,5 +1,5 @@ name: hpqtypes-version: 1.2.4+version: 1.2.5 synopsis: Haskell bindings to libpqtypes description: Efficient and easy-to-use bindings to (slightly modified)
src/Database/PostgreSQL/PQTypes/Internal/Monad.hs view
@@ -1,6 +1,6 @@ {-# LANGUAGE FlexibleContexts, FlexibleInstances, GeneralizedNewtypeDeriving , MultiParamTypeClasses, ScopedTypeVariables, TypeFamilies- , UndecidableInstances #-}+ , UndecidableInstances, CPP #-} module Database.PostgreSQL.PQTypes.Internal.Monad ( DBT(..) , runDBT@@ -90,18 +90,34 @@ ---------------------------------------- instance MonadTransControl DBT where+#if MIN_VERSION_monad_control(1,0,0)+ type StT DBT a = StT InnerDBT a+ liftWith = defaultLiftWith DBT unDBT+ restoreT = defaultRestoreT DBT+ {-# INLINE liftWith #-}+ {-# INLINE restoreT #-}+#else newtype StT DBT a = StDBT { unStDBT :: StT InnerDBT a } liftWith = defaultLiftWith DBT unDBT StDBT restoreT = defaultRestoreT DBT unStDBT {-# INLINE liftWith #-} {-# INLINE restoreT #-}+#endif instance MonadBaseControl b m => MonadBaseControl b (DBT m) where+#if MIN_VERSION_monad_control(1,0,0)+ type StM (DBT m) a = ComposeSt DBT m a+ liftBaseWith = defaultLiftBaseWith+ restoreM = defaultRestoreM+ {-# INLINE liftBaseWith #-}+ {-# INLINE restoreM #-}+#else newtype StM (DBT m) a = StMDBT { unStMDBT :: ComposeSt DBT m a } liftBaseWith = defaultLiftBaseWith StMDBT restoreM = defaultRestoreM unStMDBT {-# INLINE liftBaseWith #-} {-# INLINE restoreM #-}+#endif -- | When given 'DBException' or 'ExitCode', throw it -- immediately. Otherwise wrap it in 'DBException' first.
test/Main.hs view
@@ -1,7 +1,7 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} {-# LANGUAGE BangPatterns, DeriveDataTypeable, FlexibleContexts , GeneralizedNewtypeDeriving, MultiParamTypeClasses, OverloadedStrings- , ScopedTypeVariables, TypeFamilies, UndecidableInstances #-}+ , ScopedTypeVariables, TypeFamilies, UndecidableInstances, CPP #-} module Main where import Control.Applicative@@ -39,10 +39,17 @@ deriving (Applicative, Functor, Monad, MonadBase IO, MonadCatch, MonadDB, MonadMask, MonadThrow) instance MonadBaseControl IO TestEnv where+#if MIN_VERSION_monad_control(1,0,0)+ type StM TestEnv a = StM InnerTestEnv a+ liftBaseWith f = liftBaseWith $ \run ->+ f $ run+ restoreM = restoreM+#else newtype StM TestEnv a = StTestEnv { unStTestEnv :: StM InnerTestEnv a } liftBaseWith f = TestEnv $ liftBaseWith $ \run -> f $ liftM StTestEnv . run . unTestEnv restoreM = TestEnv . restoreM . unStTestEnv+#endif withStdGen :: (StdGen -> r) -> TestEnv r withStdGen f = do