3IvnChRMoczf0mIKpOtrYE changeset

Changeset373432623133 (b)
ParentNone (a)
ab
0+-- test.hs
0+module Main where
0+
0+import Text.JSON
0+
0+main = do
0+  x <- getLine
0+  putStrLn (show $ (decode x :: Result JSValue))
0+  main
0+
0+-- problem
0+["this","is","some","json",{"that":"works"}]
0+["this","does
0+not"]
0+
0+-- nonexhaustive_pattern.patch
0+--- Text/JSON/String.hs 2010-03-07 10:16:59.410835389 +0100
0++++ Text/JSON/String.hs_        2010-03-07 10:04:39.627628526 +0100
0+@@ -128,6 +128,7 @@
0+       '\\' : c : ds -> esc rs c ds
0+       '"'  : ds     -> do setInput ds
0+                           return (JSString (toJSString (reverse rs)))
0++      []            -> fail $ "Unexpected end of String: " ++ reverse (context rs)
0+       c    : ds
0+        | c >= '\x20' && c <= '\xff'    -> parse (c:rs) ds
0+        | c < '\x20'     -> fail $ "Illegal unescaped character in string: " ++ context cs
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
--- Revision None
+++ Revision 373432623133
@@ -0,0 +1,26 @@
+-- test.hs
+module Main where
+
+import Text.JSON
+
+main = do
+ x <- getLine
+ putStrLn (show $ (decode x :: Result JSValue))
+ main
+
+-- problem
+["this","is","some","json",{"that":"works"}]
+["this","does
+not"]
+
+-- nonexhaustive_pattern.patch
+--- Text/JSON/String.hs 2010-03-07 10:16:59.410835389 +0100
++++ Text/JSON/String.hs_ 2010-03-07 10:04:39.627628526 +0100
+@@ -128,6 +128,7 @@
+ '\\' : c : ds -> esc rs c ds
+ '"' : ds -> do setInput ds
+ return (JSString (toJSString (reverse rs)))
++ [] -> fail $ "Unexpected end of String: " ++ reverse (context rs)
+ c : ds
+ | c >= '\x20' && c <= '\xff' -> parse (c:rs) ds
+ | c < '\x20' -> fail $ "Illegal unescaped character in string: " ++ context cs