
26 Mar
2009
26 Mar
'09
12:04 p.m.
Peter Verswyvelen
Well, for JSON, I think the rendered string must be enclosed in double quotes, which is what the show instance for String does.
Ahh. I see. My version yields this output: main = let x = JString "hello" y = JNumber 10 rx = renderJValue x ry = renderJValue y in putStrLn ("[" ++ rx ++ ", " ++ ry ++ "]") $ simple [hello, 10.0] ...and that is not correct JSON format. hello looks like a variable name--not a string. The books version produces: ["hello", 10.0] which is what a javascript array that contains a string looks like. Thanks.