monarch 0.6.0.0 → 0.7.0.0
raw patch · 3 files changed
+35/−16 lines, 3 files
Files
- Database/Monarch.hs +21/−2
- Database/Monarch/Raw.hs +11/−11
- monarch.cabal +3/−3
Database/Monarch.hs view
@@ -3,8 +3,27 @@ -- module Database.Monarch (- module Database.Monarch.Raw- , module Database.Monarch.Binary+ Monarch, MonarchT+ , Connection, ConnectionPool+ , withMonarchConn+ , withMonarchPool+ , runMonarchConn+ , runMonarchPool+ , ExtOption(..), RestoreOption(..), MiscOption(..)+ , Code(..)+ , put, putKeep, putCat, putShiftLeft+ , putNoResponse+ , out+ , get, multipleGet+ , valueSize+ , iterInit, iterNext+ , forwardMatchingKeys+ , addInt, addDouble+ , ext, sync, optimize, vanish, copy, restore+ , setMaster+ , recordNum, size+ , status+ , misc ) where import Database.Monarch.Raw hiding (sendLBS, recvLBS)
Database/Monarch/Raw.hs view
@@ -73,7 +73,7 @@ instance MonadTransControl MonarchT where newtype StT MonarchT a = StMonarch { unStMonarch :: Either Code a } liftWith f = MonarchT . ErrorT . ReaderT $ (\r -> liftM Right (f $ \t -> liftM StMonarch (runReaderT (runErrorT (unMonarchT t)) r)))- restoreT = MonarchT . ErrorT . ReaderT . const .liftM unStMonarch+ restoreT = MonarchT . ErrorT . ReaderT . const . liftM unStMonarch instance MonadBaseControl base m => MonadBaseControl base (MonarchT m) where newtype StM (MonarchT m) a = StMMonarchT { unStMMonarchT :: ComposeSt MonarchT m a }@@ -92,8 +92,8 @@ -- | Create a TokyoTyrant connection and run the given action. -- Don't use the given 'Connection' outside the action. withMonarchConn :: (MonadBaseControl IO m, MonadIO m) =>- String- -> Int+ String -- ^ host+ -> Int -- ^ port -> (Connection -> m a) -> m a withMonarchConn host port f =@@ -105,9 +105,9 @@ -- | Create a TokyoTyrant connection pool and run the given action. -- Don't use the given 'ConnectionPool' outside the action. withMonarchPool :: (MonadBaseControl IO m, MonadIO m) =>- String- -> Int- -> Int+ String -- ^ host+ -> Int -- ^ port+ -> Int -- ^ number of connections -> (ConnectionPool -> m a) -> m a withMonarchPool host port size f =@@ -118,15 +118,15 @@ -- | Run action with a connection. runMonarchConn :: (MonadBaseControl IO m, MonadIO m) =>- MonarchT m a- -> Connection+ MonarchT m a -- ^ action+ -> Connection -- ^ connection -> m (Either Code a) runMonarchConn action conn = runMonarch conn action -- | Run action with a unused connection from the pool. runMonarchPool :: (MonadBaseControl IO m, MonadIO m) =>- MonarchT m a- -> ConnectionPool+ MonarchT m a -- ^ action+ -> ConnectionPool -- ^ connection pool -> m (Either Code a) runMonarchPool action pool = withResource pool (\conn -> runMonarch conn action) @@ -141,7 +141,7 @@ recvLBS :: (MonadBaseControl IO m, MonadIO m) => Int64 -> MonarchT m LBS.ByteString recvLBS n = do conn <- connection <$> ask- lbs <- liftIO (NSLBS.recv conn n) `E.catch` throwError' SendError+ lbs <- liftIO (NSLBS.recv conn n) `E.catch` throwError' ReceiveError if n /= LBS.length lbs then throwError ReceiveError else return lbs
monarch.cabal view
@@ -1,5 +1,5 @@ name: monarch-version: 0.6.0.0+version: 0.7.0.0 synopsis: Monadic interface for TokyoTyrant. description: This package provides simple monadic interface for TokyoTyrant. license: BSD3@@ -13,10 +13,10 @@ library exposed-modules: Database.Monarch- , Database.Monarch.Raw- , Database.Monarch.Binary , Database.Monarch.MessagePack other-modules: Database.Monarch.Utils+ , Database.Monarch.Raw+ , Database.Monarch.Binary ghc-options: -Wall build-depends: base ==4.* , mtl ==2.1.*