exception, not in IO

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

exception, not in IO

Kees Bleijenberg
The app I'am working on, converts a jsonString to another string encoding.

The function I want to write is  jsonString -> (encoding, errorMsg)  so
String-> (String, String)

For this purpose I have a typeable datastructure Glass. Because it is
typeable I can do (decodeJSON jsonString) :: Glass

But sometimes the jsonString is not valid (misformed or wrong fields).
decodeJSON then throws a exception.  I want to

catch that exection and transform the result to something like ("" ,
theErrorMsg). Unfortunately all catch functions want IO parameters.

What can I do?




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20130714/c8df2f80/attachment.htm>