Bump store version

This commit is contained in:
Leonid Onokhov 2017-07-04 18:55:31 +00:00
parent 9b93cc34a0
commit 502d05b867
3 changed files with 8 additions and 12 deletions

View File

@ -52,7 +52,7 @@ library
, stm
, tls
, cryptonite
, store-core
, store-core >= 0.4.1 && < 0.5
, scientific
, uuid
default-language: Haskell2010

View File

@ -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 #-}

View File

@ -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: {}