I am trying to parse a JSON string using the json library. This code works fine in GHCI:
import Text.JSON as JS JS.decode "{}" :: Result JSValue
But when I use the same code in a compiled program:
case JS.decode "{}" of JS.Ok value -> putStrLn value JS.Error err -> error err
Unable to parse string with:
Unable to read String
I suspect that only I am doing something stupid, but I canβt understand what ....
Any ideas are very welcome!
Update:
I wrote this code to see if it was something in another part of the application that caused the problem:
import qualified Text.JSON as JS main :: IO () main = do case JS.decode "{}" of JS.Ok value -> putStrLn value JS.Error err -> error err
However, I get the same error:
test: Unable to read String
It was compiled with GHC 7.0.3, and the source was edited using vim. However, even the string data transferred from outside the application generates the same error. Really out of ideas now ...
source share