Permalink
Browse files

Simplify types

Signed-off-by: Alexander Dorofeev <aka.spin@gmail.com>
  • Loading branch information...
akaspin committed Apr 27, 2012
1 parent 13b3b3d commit e148dea666db9a66cdd2cdfd073f6eed60b60ba8
View
@@ -1,5 +1,5 @@
name: couchdb-conduit
-version: 0.8.0
+version: 0.8.1
cabal-version: >= 1.8
build-type: Simple
stability: Testing
@@ -42,7 +42,6 @@ library
string-conversions,
syb,
transformers >= 0.2 && < 0.4,
- transformers-base >= 0.4 && < 0.5,
text >= 0.11 && < 0.12,
unordered-containers >= 0.1
ghc-options: -Wall
@@ -26,8 +26,6 @@ import qualified Data.Aeson as A
import qualified Network.HTTP.Conduit as H
import qualified Network.HTTP.Types as HT
-
-
import Database.CouchDB.Conduit.Internal.Connection
(MonadCouch(..), Path, mkPath)
import Database.CouchDB.Conduit.LowLevel (couch, couch', protect, protect')
@@ -12,7 +12,7 @@ import Control.Monad (void)
import Control.Exception.Lifted (catch)
import qualified Data.ByteString as B
-import qualified Data.Text as T
+import Data.Text (Text)
import qualified Data.Text.Encoding as TE
import qualified Data.HashMap.Lazy as M
import qualified Data.Aeson as A
@@ -69,7 +69,7 @@ stripObject (A.Object a) = a
stripObject _ = M.empty
-- Extract views field or return empty map
-extractViews :: M.HashMap T.Text AT.Value -> M.HashMap T.Text AT.Value
+extractViews :: M.HashMap Text AT.Value -> M.HashMap Text AT.Value
extractViews o = maybe M.empty stripObject $ M.lookup "views" o
@@ -1,8 +1,9 @@
-{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE ConstraintKinds #-}
-- | CouchDB connection.
@@ -32,12 +33,9 @@ module Database.CouchDB.Conduit.Internal.Connection (
import Control.Monad.Trans.Reader (ReaderT, ask, runReaderT)
import Control.Exception (Exception)
import Control.Monad.Trans.Class (lift)
-import Control.Monad.IO.Class (MonadIO)
-import Control.Monad.Trans.Control (MonadBaseControl (..))
+import Control.Monad.Trans.Resource (MonadBaseControl, MonadResourceBase,
+ MonadResource, ResourceT, runResourceT)
-import Data.Conduit (MonadResource, MonadThrow, MonadUnsafeIO,
- ResourceT, runResourceT)
-
import Data.Generics (Typeable)
import Data.Default (Default (def))
import qualified Data.ByteString as B
@@ -150,7 +148,7 @@ instance Exception CouchError
--
-- If you create your own instance of 'MonadCouch' or use connection pool,
-- use 'withCouchConnection'.
-runCouch :: (MonadThrow m, MonadUnsafeIO m, MonadIO m, MonadBaseControl IO m) =>
+runCouch :: (MonadResourceBase m) =>
CouchConnection -- ^ Couch connection
-> ReaderT (H.Manager, CouchConnection) (ResourceT m) a
-- ^ Actions
@@ -22,7 +22,7 @@ import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as BL
import qualified Data.Text.Encoding as TE
import qualified Data.Aeson as A
-import Data.Conduit (($$),)
+import Data.Conduit (($$))
import qualified Data.Conduit.Attoparsec as CA
import qualified Network.HTTP.Conduit as H

0 comments on commit e148dea

Please sign in to comment.