Revision 373432623133 () - Diff

Link to this snippet: https://friendpaste.com/3IvnChRMoczf0mIKpOtrYE
Embed:
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
-- 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