<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -19,8 +19,7 @@ Library
   Hs-Source-Dirs:
     src
   Build-Depends:
-    base &gt;= 3 &amp;&amp; &lt; 4, mtl, containers, network&gt;=2.2.0.0, HTTP&gt;=3001.1.3, 
-    json&gt;=0.3.3, hslogger&gt;=1.0.5
+    base, mtl, containers, network, HTTP&gt;=3001.1.4, json&gt;=0.3.3
   ghc-options:
     -fwarn-incomplete-patterns
   Extensions:     </diff>
      <filename>CouchDB.cabal</filename>
    </modified>
    <modified>
      <diff>@@ -2,7 +2,7 @@
 
 if [ `hostname` = &quot;wanderlust.local&quot; ]; then
   echo &quot;Building on wanderlust.local ...&quot;
-  ./Setup.lhs configure --user --prefix=/Users/arjun/local &amp;&amp; \
+  ./Setup.lhs configure --user --prefix=/Users/arjun/.local &amp;&amp; \
   ./Setup.lhs build &amp;&amp; \
   ./Setup.lhs haddock &amp;&amp; \
   ./Setup.lhs install</diff>
      <filename>build</filename>
    </modified>
    <modified>
      <diff>@@ -32,7 +32,6 @@ module Database.CouchDB
   , queryViewKeys
   ) where
 
-import System.Log.Logger (errorM)
 import Database.CouchDB.HTTP
 import Control.Monad
 import Control.Monad.Trans (liftIO)</diff>
      <filename>src/Database/CouchDB.hs</filename>
    </modified>
    <modified>
      <diff>@@ -13,7 +13,6 @@ module Database.CouchDB.HTTP
 
 import Data.IORef
 import Control.Concurrent
-import System.Log.Logger (errorM,debugM,infoM)
 import Network.TCP
 import Network.Stream
 import Network.HTTP
@@ -46,8 +45,7 @@ instance Monad CouchMonad where
     m' conn'
 
   fail msg = CouchMonad $ \conn -&gt; do
-    errorM &quot;couchdb&quot; msg
-    fail &quot;internal error&quot;   
+    fail $ &quot;internal error: &quot; ++ msg   
 
 instance MonadIO CouchMonad where
 
@@ -94,17 +92,12 @@ request path query method headers body = do
   let allHeaders = (makeHeaders (length body)) ++ headers 
   conn &lt;- getConn
   let req = Request url method allHeaders body
-  liftIO $ debugM &quot;couchdb.http&quot; $ &quot;Starting &quot; ++ show req
   let retry 0 = do
-        liftIO $ errorM &quot;couchdb.http&quot; $ &quot;request failed: &quot; ++ show req
-        fail &quot;server error&quot;
+        fail $ &quot;server error: &quot; ++ show req
       retry n = do
         response &lt;- liftIO $ sendHTTP conn req
         case response of
           Left err -&gt; do
-            liftIO $ infoM &quot;couchdb.http&quot; $ &quot;request failed; &quot; ++ show n ++
-              &quot; more tries left.  Error code:  &quot; ++ show err ++ &quot;, request: &quot; ++
-              show req
             reopenConnection
             retry (n-1)
           Right val -&gt; return val</diff>
      <filename>src/Database/CouchDB/HTTP.hs</filename>
    </modified>
    <modified>
      <diff>@@ -23,15 +23,17 @@ module Database.CouchDB.Unsafe
   , queryViewKeys
   ) where
 
-import System.Log.Logger (errorM)
 import Database.CouchDB.HTTP
 import Control.Monad
 import Control.Monad.Trans (liftIO)
 import Data.Maybe (fromJust,mapMaybe)
 import Text.JSON
-
 import qualified Data.List as L
 
+assertJSObject :: JSValue -&gt; CouchMonad JSValue
+assertJSObject v@(JSObject _) = return v
+assertJSObject o = fail $ &quot;expected a JSON object; received: &quot; ++ encode o
+
 couchResponse :: String -&gt; [(String,JSValue)]
 couchResponse respBody = case decode respBody of
   Error s -&gt; error s
@@ -63,8 +65,8 @@ newNamedDoc :: (JSON a)
             -- ^Returns 'Left' on a conflict.  Returns 'Right' with the
             -- revision number on success.
 newNamedDoc dbName docName body = do
-  r &lt;- request (dbName ++ &quot;/&quot; ++ docName) [] PUT [] 
-               (encode $ showJSON body)
+  obj &lt;- assertJSObject (showJSON body)
+  r &lt;- request (dbName ++ &quot;/&quot; ++ docName) [] PUT [] (encode obj)
   case rspCode r of
     (2,0,1) -&gt; do
       let result = couchResponse (rspBody r)
@@ -128,7 +130,8 @@ newDoc :: (JSON a)
       -&gt; a       -- ^document body
       -&gt; CouchMonad (JSString,JSString) -- ^ id and rev of new document
 newDoc db doc = do
-  r &lt;- request db [] POST [] (encode $ showJSON doc)
+  obj &lt;- assertJSObject (showJSON doc)
+  r &lt;- request db [] POST [] (encode obj)
   case rspCode r of
     (2,0,1) -&gt; do
       let result = couchResponse (rspBody r)</diff>
      <filename>src/Database/CouchDB/Unsafe.hs</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>75ad8606d725138b6132f396fa251ad58bab975a</id>
    </parent>
  </parents>
  <author>
    <name>Arjun Guha</name>
    <email>arjun@cs.brown.edu</email>
  </author>
  <url>http://github.com/arjunguha/haskell-couchdb/commit/5fef52b9afd40fe0cf6b3ff86d38989362d54fa5</url>
  <id>5fef52b9afd40fe0cf6b3ff86d38989362d54fa5</id>
  <committed-date>2008-11-19T07:06:14-08:00</committed-date>
  <authored-date>2008-11-19T07:06:14-08:00</authored-date>
  <message>CouchDB 0.8.1.0</message>
  <tree>d297a2c33097541f2d1a481ebe4a75bd5e2d4440</tree>
  <committer>
    <name>Arjun Guha</name>
    <email>arjun@cs.brown.edu</email>
  </committer>
</commit>
