definition: |
class ConvertJSON a where toJSON :: a -> JValue fromJSON :: JValue -> Maybe a toJSONList :: [a] -> JValue fromJSONList :: JValue -> Maybe [a] toJSONList = JArray . map toJSON fromJSONList jv = case jv of JArray xs -> let ys = map fromJSON xs in if all isJust ys then Just (catMaybes ys) else Nothing _ -> Nothing |
documentation: |
--- Type class with two conversion operations between values and their --- JSON representation. Since a JSON value might not contain --- a correct representation of a standard value, the operation --- `fromJSON` returns a `Maybe` value. --- The additional operations on value lists are used for a better --- JSON conversion of strings. |
methods: |
["toJSON :: a -> JSON.Data.JValue","fromJSON :: JSON.Data.JValue -> Prelude.Maybe a","toJSONList 0 :: [a] -> JSON.Data.JValue","fromJSONList 1 :: JSON.Data.JValue -> Prelude.Maybe [a]"] |
name: |
ConvertJSON |