Skip to content
Browse files

Fix withDB to work with new MonadMVar requirement in MongoDB 0.9

  • Loading branch information...
1 parent 08923bd commit cdab8484d2fb226c41ba6411d6090521f9422e13 @ozataman committed Dec 22, 2010
Showing with 3 additions and 4 deletions.
  1. +2 −2 src/Snap/Extension/MongoDB.hs
  2. +1 −2 src/Snap/Extension/MongoDB/MongoDB.hs
View
4 src/Snap/Extension/MongoDB.hs
@@ -38,12 +38,12 @@ class MonadSnap m => MonadMongoDB m where
----------------------------------------------------------------------------
-- | Run given MongoDB action against the database
- withDB :: ReaderT Database (Action m) a -> m (Either Failure a)
+ withDB :: ReaderT Database (Action IO) a -> m (Either Failure a)
----------------------------------------------------------------------------
-- | Same as 'withDB' but calls 'error' if there is an exception
- withDB' :: ReaderT Database (Action m) a -> m a
+ withDB' :: ReaderT Database (Action IO) a -> m a
withDB' run = do
r <- withDB run
either (error . show) return r
View
3 src/Snap/Extension/MongoDB/MongoDB.hs
@@ -60,10 +60,9 @@ instance InitializerState MongoDBState where
mkReload = const $ return ()
-
------------------------------------------------------------------------------
-- |
instance HasMongoDBState s => MonadMongoDB (SnapExtend s) where
withDB run = do
(MongoDBState pool db) <- asks getMongoDBState
- access safe Master pool $ use db run
+ liftIO . access safe Master pool $ use db run

0 comments on commit cdab848

Please sign in to comment.
Something went wrong with that request. Please try again.