Commits

John Lenz committed 0b5ff46 Merge

Merge most recent change

Comments (0)

Files changed (2)

src/Database/CouchDB/Enumerator/Generic.hs

 import qualified Database.CouchDB.Enumerator as CE (couchGet, couchPutRev)
 
 -- | CouchDB document with path (_id) and revision
-data CouchDoc a = CouchDoc Path (Maybe Revision) a deriving (Show)
+data CouchDoc a = CouchDoc Path Revision a deriving (Show)
 
 -- | Doc signature. Just for parse
-data DocSig = DocSig String (Maybe Revision)
+data DocSig = DocSig String Revision
 
 instance FromJSON DocSig where
     parseJSON (Object v) = DocSig <$>
         v .: "_id" <*>
-        v .:? "_rev" .!= Nothing
+        v .:? "_rev" .!= ""
     parseJSON _ = mzero
 
 -- | Load a single object from couch DB.

test/Database/CouchDB/Enumerator/Test/Generic.hs

 -- | Just put and get doc
 case_simpleGeneric :: Assertion
 case_simpleGeneric = runCouch "localhost" 5984 "testcouchdbenum" $ do
-    rev <- E.catch (do 
-        r1 <- couchRev "gen_doc"
-        return $ Just r1)
-        (\(_ :: CouchError) -> return Nothing) 
+    rev <- E.catch (couchRev "gen_doc")
+        (\(_ :: CouchError) -> return "") 
 --    liftIO $ print rev
 --    couchDelete "gen_doc3" $ fromJust rev        
     _ <- CG.couchPut "gen_doc" rev [] genDoc