ReviewBoard-0.2: Haskell bindings to ReviewBoardSource codeContentsIndex
JSON response utils
Basic Response DSL
This is an optional module that provides additional functionality to simplify handling of ReviewBoard responses.
js4path :: [String] -> JSValue -> Maybe JSValue
js4name :: String -> JSValue -> Maybe JSValue
js2v :: JSON a => JSValue -> a
mkrb :: JSON a => String -> JSValue -> a
JSON response utils
js4path :: [String] -> JSValue -> Maybe JSValueSource
Get JSValue for name path, for example for JSON object '{ "obj1" : { "str" : "test" } }' js4path ["obj1", "str"] returns Just test
js4name :: String -> JSValue -> Maybe JSValueSource
Get value for name from a JSObject or Nothing if JSValue is not a JSObject
js2v :: JSON a => JSValue -> aSource
Extract value from JSValue or throw error
Basic Response DSL

The DSL provides a function for (almost) every ReviewBoard JSObject member that directly returns the value of the member. The function name is equivalent to the name of the member element, for example values of a response like:

 { "stat": "fail", 
   "err": {
     "msg": "You are not logged in", 
     "code": 103

may be accessed as following:

 (msg . err) response
 -- returns 'You are not logged in' :: String
 (code . err) response
 -- returns 103 :: Integer

If the entry name represented by the function does not exist, an error is thrown.

The current function list is build by screen scraping ReviewBoard source code, so it's likely that some elements are missing. The missing function can be added using mkrb function. Please drop me an email if you find one and I will include this in the next version.

mkrb :: JSON a => String -> JSValue -> aSource
Constructor for DSL functions
Produced by Haddock version 2.3.0