Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fix withDB to work with new MonadMVar requirement in MongoDB 0.9

  • Loading branch information...
commit cdab8484d2fb226c41ba6411d6090521f9422e13 1 parent 08923bd
Ozgun Ataman authored
4 src/Snap/Extension/MongoDB.hs
@@ -38,12 +38,12 @@ class MonadSnap m => MonadMongoDB m where
38 38
39 39 ----------------------------------------------------------------------------
40 40 -- | Run given MongoDB action against the database
41   - withDB :: ReaderT Database (Action m) a -> m (Either Failure a)
  41 + withDB :: ReaderT Database (Action IO) a -> m (Either Failure a)
42 42
43 43
44 44 ----------------------------------------------------------------------------
45 45 -- | Same as 'withDB' but calls 'error' if there is an exception
46   - withDB' :: ReaderT Database (Action m) a -> m a
  46 + withDB' :: ReaderT Database (Action IO) a -> m a
47 47 withDB' run = do
48 48 r <- withDB run
49 49 either (error . show) return r
3  src/Snap/Extension/MongoDB/MongoDB.hs
@@ -60,10 +60,9 @@ instance InitializerState MongoDBState where
60 60 mkReload = const $ return ()
61 61
62 62
63   -
64 63 ------------------------------------------------------------------------------
65 64 -- |
66 65 instance HasMongoDBState s => MonadMongoDB (SnapExtend s) where
67 66 withDB run = do
68 67 (MongoDBState pool db) <- asks getMongoDBState
69   - access safe Master pool $ use db run
  68 + 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.