From 502d05b86760540245dd742ed19745217eb9bf52 Mon Sep 17 00:00:00 2001 From: Leonid Onokhov Date: Tue, 4 Jul 2017 18:55:31 +0000 Subject: [PATCH 1/2] Bump store version --- postgres-wire.cabal | 2 +- src/Database/PostgreSQL/Protocol/Store/Decode.hs | 15 ++++++--------- stack.yaml | 3 +-- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/postgres-wire.cabal b/postgres-wire.cabal index 49d4daf..31d2e5f 100644 --- a/postgres-wire.cabal +++ b/postgres-wire.cabal @@ -52,7 +52,7 @@ library , stm , tls , cryptonite - , store-core + , store-core >= 0.4.1 && < 0.5 , scientific , uuid default-language: Haskell2010 diff --git a/src/Database/PostgreSQL/Protocol/Store/Decode.hs b/src/Database/PostgreSQL/Protocol/Store/Decode.hs index 237bdb3..29c56e9 100644 --- a/src/Database/PostgreSQL/Protocol/Store/Decode.hs +++ b/src/Database/PostgreSQL/Protocol/Store/Decode.hs @@ -33,15 +33,14 @@ runDecodeIO (Decode dec) bs = do embedIO :: IO a -> Decode a embedIO action = Decode $ Peek $ \_ ptr -> do v <- action - return (ptr, v) + pure (PeekResult ptr v) {-# INLINE prim #-} prim :: Int -> (Ptr Word8 -> IO a) -> Decode a prim len f = Decode $ Peek $ \ps ptr -> do !v <- f ptr let !newPtr = ptr `plusPtr` len - return (newPtr, v) - -- return $ PeekResult newPtr v + pure (PeekResult newPtr v) -- Public @@ -54,16 +53,14 @@ getByteString :: Int -> Decode B.ByteString getByteString len = Decode $ Peek $ \ps ptr -> do bs <- B.packCStringLen (castPtr ptr, len) let !newPtr = ptr `plusPtr` len - -- return $ PeekResult newPtr bs - return (newPtr, bs) + pure (PeekResult newPtr bs) {-# INLINE getByteStringNull #-} getByteStringNull :: Decode B.ByteString getByteStringNull = Decode $ Peek $ \ps ptr -> do bs <- B.packCString (castPtr ptr) let !newPtr = ptr `plusPtr` (B.length bs + 1) - -- return $ PeekResult newPtr bs - return (newPtr, bs) + pure (PeekResult newPtr bs) {-# INLINE getWord8 #-} getWord8 :: Decode Word8 @@ -95,12 +92,12 @@ getInt64BE = fromIntegral <$> getWord64BE {-# INLINE getFloat32BE #-} getFloat32BE :: Decode Float -getFloat32BE = prim 4 $ \ptr -> byteSwap32 <$> peek (castPtr ptr) +getFloat32BE = prim 4 $ \ptr -> byteSwap32 <$> peek (castPtr ptr) >>= wordToFloat {-# INLINE getFloat64BE #-} getFloat64BE :: Decode Double -getFloat64BE = prim 8 $ \ptr -> byteSwap64 <$> peek (castPtr ptr) +getFloat64BE = prim 8 $ \ptr -> byteSwap64 <$> peek (castPtr ptr) >>= wordToFloat {-# INLINE wordToFloat #-} diff --git a/stack.yaml b/stack.yaml index 4fc7ad8..67c7d42 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,6 +1,6 @@ # This file was automatically generated by 'stack init' # -resolver: lts-8.0 +resolver: lts-8.21 packages: - '.' @@ -9,7 +9,6 @@ packages: extra-deps: - socket-0.8.0.0 - socket-unix-0.2.0.0 - - store-core-0.3 # Override default flag values for local packages and extra-deps flags: {} From c7d6e5afcde710af6183522dba2822bf4ae0b6ff Mon Sep 17 00:00:00 2001 From: Leonid Onokhov Date: Tue, 4 Jul 2017 19:04:20 +0000 Subject: [PATCH 2/2] Export TlsMode constructor and fix test build --- src/Database/PostgreSQL/Driver/Settings.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Database/PostgreSQL/Driver/Settings.hs b/src/Database/PostgreSQL/Driver/Settings.hs index dc302b7..503c34d 100644 --- a/src/Database/PostgreSQL/Driver/Settings.hs +++ b/src/Database/PostgreSQL/Driver/Settings.hs @@ -1,6 +1,6 @@ -module Database.PostgreSQL.Driver.Settings +module Database.PostgreSQL.Driver.Settings ( ConnectionSettings(..) - , TlsMode + , TlsMode (..) , defaultConnectionSettings ) where