packages feed

higher-leveldb 0.5.0.0 → 0.5.0.1

raw patch · 3 files changed

+23/−5 lines, 3 filesdep +unliftioPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

Dependencies added: unliftio

API changes (from Hackage documentation)

+ Database.LevelDB.Higher: instance Control.Monad.IO.Unlift.MonadUnliftIO m => Control.Monad.IO.Unlift.MonadUnliftIO (Database.LevelDB.Higher.LevelDBT m)

Files

higher-leveldb.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                higher-leveldb-version:             0.5.0.0+version:             0.5.0.1 synopsis:            A rich monadic API for working with leveldb databases. description:         A rich monadic API for working with leveldb databases. homepage:            https://github.com/jeremyjh/higher-leveldb@@ -55,3 +55,4 @@                    , transformers-base                    , mtl                    , transformers+                   , unliftio
src/Database/LevelDB/Higher.hs view
@@ -73,6 +73,7 @@ import           Control.Monad.Trans.Resource import           Control.Monad.Catch               (MonadCatch (..)                                                    , MonadMask (..))+import           Control.Monad.IO.Unlift  #if MIN_VERSION_mtl(2,2,1) import qualified Control.Monad.Except              as Except@@ -170,6 +171,11 @@         q ::  (ResourceT m a -> ResourceT m a) -> LevelDBT m a -> LevelDBT m a         q u (LevelDBT (ReaderT b)) =           LevelDBT $ ReaderT (u . b)++instance MonadUnliftIO m => MonadUnliftIO (LevelDBT m) where+  askUnliftIO = LevelDBT $+                withUnliftIO $ \u ->+                return (UnliftIO (unliftIO u . unLevelDBT))  -- | MonadLevelDB class used by all the public functions in this module. class ( Monad m
test/Database/LevelDB/HigherSpec.hs view
@@ -9,7 +9,8 @@ import           Test.Hspec import           System.Process(system) import           Database.LevelDB.Higher-import           Control.Concurrent                (ThreadId, threadDelay)+import           UnliftIO.Concurrent                (ThreadId, threadDelay)+import           UnliftIO.MVar import           Control.Monad.Trans.Resource import           Control.Monad.Reader import           Control.Monad.Writer@@ -128,9 +129,9 @@                     put "onetwo" "three"                     forkTestAppR $ do                         rv <- ask-                        liftIO $ threadDelay 1+                        threadDelay 1                         put "three" rv-                    liftIO $ threadDelay 100+                    threadDelay 100                     get "three"                 `shouldReturn` Just "a string value to read"             it "scans with a keyspace" $ do@@ -140,7 +141,17 @@                     xs <- scan "" queryItems                     return $ length xs                 `shouldReturn` 10-+        describe "exports a working MonadUnliftIO instance" $ do+          it "can modifyMVar in a working LevelDBT context" $ do+            withDBT $ do+                mv <- newMVar 0+                modifyMVar_ mv $ \v -> do+                    put "somekey" "somedata"+                    return (v + 1)+                mvalue <- readMVar mv+                Just ldbvalue <- get "somekey"+                return (mvalue, ldbvalue)+            `shouldReturn` (1, "somedata")  testDB = "/tmp/leveltest" dbOpts = def {createIfMissing = True, cacheSize= 2048}