Skip to content

Commit 0041023

Browse files
author
Martin Hilbig
committed
made a JSON instance for Rev
1 parent 3f01196 commit 0041023

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Database/CouchDB.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ data Rev = Rev { unRev :: JSString } deriving (Eq,Ord)
8787
instance Show Rev where
8888
show (Rev s) = fromJSString s
8989

90+
instance JSON Rev where
91+
readJSON (JSString s) = return (Rev s)
92+
readJSON _ = fail "readJSON: not a valid document revision"
93+
94+
showJSON (Rev s) = showJSON s
95+
9096
-- |Document name
9197
data Doc = Doc { unDoc :: JSString } deriving (Eq,Ord)
9298

0 commit comments

Comments
 (0)