Skip to content

Commit 5dae8ad

Browse files
author
Arjun Guha
committed
getAndUpdateDoc type changed; requires HTTP<4000.0.0 for the moment
1 parent 0e58533 commit 5dae8ad

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

CouchDB.cabal

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Name: CouchDB
2-
Version: 0.8.1.0
2+
Version: 0.8.1.1
33
Cabal-Version:>= 1.2.4
44
Copyright: Copyright (c) 2008 Arjun Guha and Brendan Hickey
55
License: BSD3
@@ -19,7 +19,7 @@ Library
1919
Hs-Source-Dirs:
2020
src
2121
Build-Depends:
22-
base, mtl, containers, network, HTTP>=3001.1.4, json>=0.3.3
22+
base, mtl, containers, network, HTTP<4000.0.0, json>=0.3.3
2323
ghc-options:
2424
-fwarn-incomplete-patterns
2525
Extensions:

src/Database/CouchDB.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ getDocPrim db doc = do
205205
getAndUpdateDoc :: (JSON a)
206206
=> DB -- ^database
207207
-> Doc -- ^document name
208-
-> (a -> a) -- ^update function
208+
-> (a -> IO a) -- ^update function
209209
-> CouchMonad (Maybe Rev) -- ^If the update succeeds,
210210
-- return the revision number
211211
-- of the result.

src/Database/CouchDB/Unsafe.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,15 +179,16 @@ getDocPrim db doc = do
179179
getAndUpdateDoc :: (JSON a)
180180
=> String -- ^database
181181
-> String -- ^document name
182-
-> (a -> a) -- ^update function
182+
-> (a -> IO a) -- ^update function
183183
-> CouchMonad (Maybe String) -- ^If the update succeeds,
184184
-- return the revision number
185185
-- of the result.
186186
getAndUpdateDoc db docId fn = do
187187
r <- getDoc db docId
188188
case r of
189189
Just (id,rev,val) -> do
190-
r <- updateDoc db (id,rev) (fn val)
190+
val' <- liftIO (fn val)
191+
r <- updateDoc db (id,rev) val'
191192
case r of
192193
Just (id,rev) -> return (Just $ fromJSString rev)
193194
Nothing -> return Nothing

0 commit comments

Comments
 (0)