Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Re: exception, not in IO (Lyndon Maydwell)
----------------------------------------------------------------------
Message: 1
Date: Sun, 14 Jul 2013 20:30:32 +1000
From: Lyndon Maydwell <[email protected]>
Subject: Re: [Haskell-beginners] exception, not in IO
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Message-ID:
<cam5qztz7z_1zpgjiyvennqqdtamxbcj+1eamfkmtz+6nu0a...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
You can turn anything into an IO action with return, or you could catch the
exception at a level where you are performing IO. Would this be what you're
after?
On Sun, Jul 14, 2013 at 7:47 PM, Kees Bleijenberg <
[email protected]> wrote:
> 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?****
>
> ** **
>
> Kees****
>
> ** **
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20130714/8a48744b/attachment-0001.htm>
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 61, Issue 18
*****************************************