updateCurrent :: String -> IO ()
updateCurrent newRef = do
    theDoc <- runCouchDB' $ getDoc contas $ doc "current"
    let Just (doc1, rev1, json1 :: JSValue) = theDoc
    let (Ok (item1 :: Item)) = fromJSON json1
    let json2 = toJSON item1 { ref = newRef }
    Just (doc2, rev2) <- runCouchDB' $ updateDoc contas (doc1, rev1) json2
    return ()

-- Add a new doc with given blob.
-- The new doc points to the previous current doc and current now points
-- to the new doc
updateCurrent :: String -> IO ()
updateCurrent newRef = do
    theDoc <- runCouchDB' $ getDoc contas $ doc "current"
    let Just (doc1, rev1, json1 :: JSValue) = theDoc
    let (Ok (item1 :: Item)) = fromJSON json1
    let json2 = toJSON item1 { ref = newRef }
    Just (doc2, rev2) <- runCouchDB' $ updateDoc contas (doc1, rev1) json2
    return ()

-- Add a new doc with given blob.
-- The new doc points to the previous current doc and current now points
-- to the new doc
updateCurrent newRef = do
    theDoc <- runCouchDB' $ getDoc contas $ doc "current"
    let Just (doc1, rev1, json1 :: JSValue) = theDoc
    let (Ok (item1 :: Item)) = fromJSON json1
    let json2 = toJSON item1 { ref = newRef }
    Just (doc2, rev2) <- runCouchDB' $ updateDoc contas (doc1, rev1) json2
    return ()

-- Add a new doc with given blob.
-- The new doc points to the previous current doc and current now points
-- to the new doc