<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin-top:0cm;
        margin-right:0cm;
        margin-bottom:10.0pt;
        margin-left:0cm;
        line-height:115%;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
h1
        {mso-style-priority:9;
        mso-style-link:"Kop 1 Char";
        margin-top:24.0pt;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:0cm;
        margin-bottom:.0001pt;
        line-height:115%;
        font-size:14.0pt;
        font-family:"Cambria","serif";}
h1.CxSpFirst
        {mso-style-priority:9;
        mso-style-link:"Kop 1 Char";
        mso-style-type:export-only;
        margin-top:24.0pt;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:0cm;
        margin-bottom:.0001pt;
        line-height:115%;
        font-size:14.0pt;
        font-family:"Cambria","serif";}
h1.CxSpMiddle
        {mso-style-priority:9;
        mso-style-link:"Kop 1 Char";
        mso-style-type:export-only;
        margin:0cm;
        margin-bottom:.0001pt;
        line-height:115%;
        font-size:14.0pt;
        font-family:"Cambria","serif";}
h1.CxSpLast
        {mso-style-priority:9;
        mso-style-link:"Kop 1 Char";
        mso-style-type:export-only;
        margin:0cm;
        margin-bottom:.0001pt;
        line-height:115%;
        font-size:14.0pt;
        font-family:"Cambria","serif";}
h2
        {mso-style-priority:9;
        mso-style-link:"Kop 2 Char";
        margin-top:10.0pt;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:0cm;
        margin-bottom:.0001pt;
        line-height:115%;
        font-size:13.0pt;
        font-family:"Cambria","serif";}
h3
        {mso-style-priority:9;
        mso-style-link:"Kop 3 Char";
        margin-top:10.0pt;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:0cm;
        margin-bottom:.0001pt;
        line-height:112%;
        font-size:11.0pt;
        font-family:"Cambria","serif";}
h4
        {mso-style-priority:9;
        mso-style-link:"Kop 4 Char";
        margin-top:10.0pt;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:0cm;
        margin-bottom:.0001pt;
        line-height:115%;
        font-size:11.0pt;
        font-family:"Cambria","serif";
        font-style:italic;}
h5
        {mso-style-priority:9;
        mso-style-link:"Kop 5 Char";
        margin-top:10.0pt;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:0cm;
        margin-bottom:.0001pt;
        line-height:115%;
        font-size:11.0pt;
        font-family:"Cambria","serif";
        color:#7F7F7F;}
h6
        {mso-style-priority:9;
        mso-style-link:"Kop 6 Char";
        margin:0cm;
        margin-bottom:.0001pt;
        line-height:112%;
        font-size:11.0pt;
        font-family:"Cambria","serif";
        color:#7F7F7F;
        font-style:italic;}
p.MsoHeading7, li.MsoHeading7, div.MsoHeading7
        {mso-style-priority:9;
        mso-style-link:"Kop 7 Char";
        margin:0cm;
        margin-bottom:.0001pt;
        line-height:115%;
        font-size:11.0pt;
        font-family:"Cambria","serif";
        font-style:italic;}
p.MsoHeading8, li.MsoHeading8, div.MsoHeading8
        {mso-style-priority:9;
        mso-style-link:"Kop 8 Char";
        margin:0cm;
        margin-bottom:.0001pt;
        line-height:115%;
        font-size:10.0pt;
        font-family:"Cambria","serif";}
p.MsoHeading9, li.MsoHeading9, div.MsoHeading9
        {mso-style-priority:9;
        mso-style-link:"Kop 9 Char";
        margin:0cm;
        margin-bottom:.0001pt;
        line-height:115%;
        font-size:10.0pt;
        font-family:"Cambria","serif";
        letter-spacing:.25pt;
        font-style:italic;}
p.MsoTitle, li.MsoTitle, div.MsoTitle
        {mso-style-priority:10;
        mso-style-link:"Titel Char";
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:10.0pt;
        margin-left:0cm;
        border:none;
        padding:0cm;
        font-size:26.0pt;
        font-family:"Cambria","serif";
        letter-spacing:.25pt;}
p.MsoTitleCxSpFirst, li.MsoTitleCxSpFirst, div.MsoTitleCxSpFirst
        {mso-style-priority:10;
        mso-style-link:"Titel Char";
        mso-style-type:export-only;
        margin:0cm;
        margin-bottom:.0001pt;
        border:none;
        padding:0cm;
        font-size:26.0pt;
        font-family:"Cambria","serif";
        letter-spacing:.25pt;}
p.MsoTitleCxSpMiddle, li.MsoTitleCxSpMiddle, div.MsoTitleCxSpMiddle
        {mso-style-priority:10;
        mso-style-link:"Titel Char";
        mso-style-type:export-only;
        margin:0cm;
        margin-bottom:.0001pt;
        border:none;
        padding:0cm;
        font-size:26.0pt;
        font-family:"Cambria","serif";
        letter-spacing:.25pt;}
p.MsoTitleCxSpLast, li.MsoTitleCxSpLast, div.MsoTitleCxSpLast
        {mso-style-priority:10;
        mso-style-link:"Titel Char";
        mso-style-type:export-only;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:10.0pt;
        margin-left:0cm;
        border:none;
        padding:0cm;
        font-size:26.0pt;
        font-family:"Cambria","serif";
        letter-spacing:.25pt;}
p.MsoSubtitle, li.MsoSubtitle, div.MsoSubtitle
        {mso-style-priority:11;
        mso-style-link:"Subtitel Char";
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:30.0pt;
        margin-left:0cm;
        line-height:115%;
        font-size:12.0pt;
        font-family:"Cambria","serif";
        letter-spacing:.65pt;
        font-style:italic;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
em
        {mso-style-priority:20;
        letter-spacing:.5pt;
        border:none;
        font-weight:bold;}
p.MsoNoSpacing, li.MsoNoSpacing, div.MsoNoSpacing
        {mso-style-priority:1;
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:10.0pt;
        margin-left:36.0pt;
        line-height:115%;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst
        {mso-style-priority:34;
        mso-style-type:export-only;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        line-height:115%;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle
        {mso-style-priority:34;
        mso-style-type:export-only;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        line-height:115%;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast
        {mso-style-priority:34;
        mso-style-type:export-only;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:10.0pt;
        margin-left:36.0pt;
        line-height:115%;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
p.MsoQuote, li.MsoQuote, div.MsoQuote
        {mso-style-priority:29;
        mso-style-link:"Citaat Char";
        margin-top:10.0pt;
        margin-right:18.0pt;
        margin-bottom:0cm;
        margin-left:18.0pt;
        margin-bottom:.0001pt;
        line-height:115%;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        font-style:italic;}
p.MsoIntenseQuote, li.MsoIntenseQuote, div.MsoIntenseQuote
        {mso-style-priority:30;
        mso-style-link:"Duidelijk citaat Char";
        margin-top:10.0pt;
        margin-right:57.6pt;
        margin-bottom:14.0pt;
        margin-left:50.4pt;
        text-align:justify;
        text-justify:inter-ideograph;
        line-height:115%;
        border:none;
        padding:0cm;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        font-weight:bold;
        font-style:italic;}
span.MsoSubtleEmphasis
        {mso-style-priority:19;
        font-style:italic;}
span.MsoIntenseEmphasis
        {mso-style-priority:21;
        font-weight:bold;}
span.MsoSubtleReference
        {mso-style-priority:31;
        font-variant:small-caps;}
span.MsoIntenseReference
        {mso-style-priority:32;
        font-variant:small-caps;
        letter-spacing:.25pt;
        text-decoration:underline;}
span.MsoBookTitle
        {mso-style-priority:33;
        font-variant:small-caps;
        letter-spacing:.25pt;
        font-style:italic;}
p.MsoTocHeading, li.MsoTocHeading, div.MsoTocHeading
        {mso-style-priority:39;
        margin-top:24.0pt;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:0cm;
        margin-bottom:.0001pt;
        line-height:115%;
        font-size:14.0pt;
        font-family:"Cambria","serif";
        font-weight:bold;}
p.MsoTocHeadingCxSpFirst, li.MsoTocHeadingCxSpFirst, div.MsoTocHeadingCxSpFirst
        {mso-style-priority:39;
        mso-style-type:export-only;
        margin-top:24.0pt;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:0cm;
        margin-bottom:.0001pt;
        line-height:115%;
        font-size:14.0pt;
        font-family:"Cambria","serif";
        font-weight:bold;}
p.MsoTocHeadingCxSpMiddle, li.MsoTocHeadingCxSpMiddle, div.MsoTocHeadingCxSpMiddle
        {mso-style-priority:39;
        mso-style-type:export-only;
        margin:0cm;
        margin-bottom:.0001pt;
        line-height:115%;
        font-size:14.0pt;
        font-family:"Cambria","serif";
        font-weight:bold;}
p.MsoTocHeadingCxSpLast, li.MsoTocHeadingCxSpLast, div.MsoTocHeadingCxSpLast
        {mso-style-priority:39;
        mso-style-type:export-only;
        margin:0cm;
        margin-bottom:.0001pt;
        line-height:115%;
        font-size:14.0pt;
        font-family:"Cambria","serif";
        font-weight:bold;}
span.hoenzb
        {mso-style-name:hoenzb;}
span.E-mailStijl18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.Kop1Char
        {mso-style-name:"Kop 1 Char";
        mso-style-priority:9;
        mso-style-link:"Kop 1";
        font-family:"Cambria","serif";
        font-weight:bold;}
span.Kop2Char
        {mso-style-name:"Kop 2 Char";
        mso-style-priority:9;
        mso-style-link:"Kop 2";
        font-family:"Cambria","serif";
        font-weight:bold;}
span.Kop3Char
        {mso-style-name:"Kop 3 Char";
        mso-style-priority:9;
        mso-style-link:"Kop 3";
        font-family:"Cambria","serif";
        font-weight:bold;}
span.Kop4Char
        {mso-style-name:"Kop 4 Char";
        mso-style-priority:9;
        mso-style-link:"Kop 4";
        font-family:"Cambria","serif";
        font-weight:bold;
        font-style:italic;}
span.Kop5Char
        {mso-style-name:"Kop 5 Char";
        mso-style-priority:9;
        mso-style-link:"Kop 5";
        font-family:"Cambria","serif";
        color:#7F7F7F;
        font-weight:bold;}
span.Kop6Char
        {mso-style-name:"Kop 6 Char";
        mso-style-priority:9;
        mso-style-link:"Kop 6";
        font-family:"Cambria","serif";
        color:#7F7F7F;
        font-weight:bold;
        font-style:italic;}
span.Kop7Char
        {mso-style-name:"Kop 7 Char";
        mso-style-priority:9;
        mso-style-link:"Kop 7";
        font-family:"Cambria","serif";
        font-style:italic;}
span.Kop8Char
        {mso-style-name:"Kop 8 Char";
        mso-style-priority:9;
        mso-style-link:"Kop 8";
        font-family:"Cambria","serif";}
span.Kop9Char
        {mso-style-name:"Kop 9 Char";
        mso-style-priority:9;
        mso-style-link:"Kop 9";
        font-family:"Cambria","serif";
        letter-spacing:.25pt;
        font-style:italic;}
span.TitelChar
        {mso-style-name:"Titel Char";
        mso-style-priority:10;
        mso-style-link:Titel;
        font-family:"Cambria","serif";
        letter-spacing:.25pt;}
span.SubtitelChar
        {mso-style-name:"Subtitel Char";
        mso-style-priority:11;
        mso-style-link:Subtitel;
        font-family:"Cambria","serif";
        letter-spacing:.65pt;
        font-style:italic;}
span.CitaatChar
        {mso-style-name:"Citaat Char";
        mso-style-priority:29;
        mso-style-link:Citaat;
        font-style:italic;}
span.DuidelijkcitaatChar
        {mso-style-name:"Duidelijk citaat Char";
        mso-style-priority:30;
        mso-style-link:"Duidelijk citaat";
        font-weight:bold;
        font-style:italic;}
.MsoChpDefault
        {mso-style-type:export-only;}
.MsoPapDefault
        {mso-style-type:export-only;
        margin-bottom:10.0pt;
        line-height:115%;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=NL link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Lyndon,<o:p></o:p></span></p><div><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>You wrote:<br></span><span lang=EN-US>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?<o:p></o:p></span></p></div><div><p class=MsoNormal style='margin-bottom:12.0pt'><span lang=EN-US style='color:#1F497D'>Wait until you perform IO, seems quit uneasy to me and why? Converting a string to a typeable is not a IO action. Problem is that this function lives in a dll. The IO is done by the calling program (not a Haskell program). The function is not in a monad, it is a pure function. So I think I can’t do a return.<o:p></o:p></span></p><p class=MsoNormal style='margin-bottom:12.0pt'><span lang=EN-US style='color:#1F497D'>Kees</span><span lang=EN-US style='color:#1F497D'><o:p></o:p></span></p><div><div><div><p class=MsoNormal><span lang=EN-US>On Sun, Jul 14, 2013 at 7:47 PM, Kees Bleijenberg &lt;<a href="mailto:k.bleijenberg@lijbrandt.nl" target="_blank">k.bleijenberg@lijbrandt.nl</a>&gt; wrote:<span style='color:#1F497D'><o:p></o:p></span></span></p><p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt'><span lang=EN-US>The app I’am working on, converts a jsonString to another string encoding. <o:p></o:p></span></p><p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt'><span lang=EN-US>The function I want to write is&nbsp; jsonString -&gt; (encoding, errorMsg)&nbsp; so String-&gt; (String, String) <o:p></o:p></span></p><p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt'><span lang=EN-US>For this purpose I have a typeable datastructure Glass. Because it is typeable I can do (decodeJSON jsonString) :: Glass<o:p></o:p></span></p><p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt'><span lang=EN-US>But sometimes the jsonString is not valid (misformed or wrong fields). decodeJSON then throws a exception.&nbsp; I want to<o:p></o:p></span></p><p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt'><span lang=EN-US>catch that exection and transform the result to something like (“” , theErrorMsg). Unfortunately all catch functions want IO parameters. <o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US>What can I do?<o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US style='color:#888888'>&nbsp;<o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US style='color:#888888'>Kees<o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US style='color:#888888'>&nbsp;<o:p></o:p></span></p></div></div><p class=MsoNormal style='margin-bottom:12.0pt'><span lang=EN-US><br>_______________________________________________<br>Beginners mailing list<br><a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br><a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><o:p></o:p></span></p></div><p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt'><span lang=EN-US><o:p>&nbsp;</o:p></span></p></div></div></body></html>