Drop MonadBaseControl from two more modules
This commit is contained in:
parent
282d228ff2
commit
77c7ee3ee9
2 changed files with 5 additions and 7 deletions
|
@ -42,7 +42,6 @@ import qualified Data.HashTable.IO as H
|
||||||
import qualified Data.Set as Set
|
import qualified Data.Set as Set
|
||||||
|
|
||||||
import Control.Monad.Trans (MonadIO, liftIO)
|
import Control.Monad.Trans (MonadIO, liftIO)
|
||||||
import Control.Monad.Trans.Control (MonadBaseControl)
|
|
||||||
import Data.Bson (Document, Field(..), at, (=:), (=?), exclude, merge)
|
import Data.Bson (Document, Field(..), at, (=:), (=?), exclude, merge)
|
||||||
import Data.Text (Text)
|
import Data.Text (Text)
|
||||||
|
|
||||||
|
@ -138,7 +137,7 @@ dropIndex coll idxName = do
|
||||||
resetIndexCache
|
resetIndexCache
|
||||||
runCommand ["deleteIndexes" =: coll, "index" =: idxName]
|
runCommand ["deleteIndexes" =: coll, "index" =: idxName]
|
||||||
|
|
||||||
getIndexes :: (MonadIO m, MonadBaseControl IO m, Functor m) => Collection -> Action m [Document]
|
getIndexes :: MonadIO m => Collection -> Action m [Document]
|
||||||
-- ^ Get all indexes on this collection
|
-- ^ Get all indexes on this collection
|
||||||
getIndexes coll = do
|
getIndexes coll = do
|
||||||
db <- thisDatabase
|
db <- thisDatabase
|
||||||
|
@ -191,9 +190,9 @@ resetIndexCache = do
|
||||||
|
|
||||||
-- ** User
|
-- ** User
|
||||||
|
|
||||||
allUsers :: (MonadIO m, MonadBaseControl IO m, Functor m) => Action m [Document]
|
allUsers :: MonadIO m => Action m [Document]
|
||||||
-- ^ Fetch all users of this database
|
-- ^ Fetch all users of this database
|
||||||
allUsers = map (exclude ["_id"]) <$> (rest =<< find
|
allUsers = map (exclude ["_id"]) `liftM` (rest =<< find
|
||||||
(select [] "system.users") {sort = ["user" =: (1 :: Int)], project = ["user" =: (1 :: Int), "readOnly" =: (1 :: Int)]})
|
(select [] "system.users") {sort = ["user" =: (1 :: Int)], project = ["user" =: (1 :: Int), "readOnly" =: (1 :: Int)]})
|
||||||
|
|
||||||
addUser :: (MonadIO m)
|
addUser :: (MonadIO m)
|
||||||
|
@ -260,7 +259,7 @@ storageSize c = at "storageSize" `liftM` collectionStats c
|
||||||
totalIndexSize :: (MonadIO m) => Collection -> Action m Int
|
totalIndexSize :: (MonadIO m) => Collection -> Action m Int
|
||||||
totalIndexSize c = at "totalIndexSize" `liftM` collectionStats c
|
totalIndexSize c = at "totalIndexSize" `liftM` collectionStats c
|
||||||
|
|
||||||
totalSize :: (MonadIO m, MonadBaseControl IO m) => Collection -> Action m Int
|
totalSize :: MonadIO m => Collection -> Action m Int
|
||||||
totalSize coll = do
|
totalSize coll = do
|
||||||
x <- storageSize coll
|
x <- storageSize coll
|
||||||
xs <- mapM isize =<< getIndexes coll
|
xs <- mapM isize =<< getIndexes coll
|
||||||
|
|
|
@ -28,7 +28,6 @@ import Control.Concurrent(forkIO)
|
||||||
import Control.Monad(when)
|
import Control.Monad(when)
|
||||||
import Control.Monad.IO.Class
|
import Control.Monad.IO.Class
|
||||||
import Control.Monad.Trans(MonadTrans, lift)
|
import Control.Monad.Trans(MonadTrans, lift)
|
||||||
import Control.Monad.Trans.Control(MonadBaseControl)
|
|
||||||
import Control.Monad.Trans.Resource(MonadResource(..))
|
import Control.Monad.Trans.Resource(MonadResource(..))
|
||||||
import Data.Conduit
|
import Data.Conduit
|
||||||
import Data.Digest.Pure.MD5
|
import Data.Digest.Pure.MD5
|
||||||
|
@ -76,7 +75,7 @@ getChunk (File bucket doc) i = do
|
||||||
Just (Binary b) -> return (Just b)
|
Just (Binary b) -> return (Just b)
|
||||||
_ -> return Nothing
|
_ -> return Nothing
|
||||||
|
|
||||||
findFile :: (MonadIO m, MonadBaseControl IO m) => Bucket -> Selector -> Action m [File]
|
findFile :: MonadIO m => Bucket -> Selector -> Action m [File]
|
||||||
-- ^ Find files in the bucket
|
-- ^ Find files in the bucket
|
||||||
findFile bucket sel = do
|
findFile bucket sel = do
|
||||||
cursor <- find $ select sel $ files bucket
|
cursor <- find $ select sel $ files bucket
|
||||||
|
|
Loading…
Reference in a new issue