<div dir="ltr">This :<div><br></div><div><div>Prelude&gt; let f = (\x -&gt; return &quot;something went wrong&quot;) &nbsp;:: &nbsp; IOError -&gt; IO String</div><div>Prelude&gt; let t = return $ show $ &quot;too short list&quot; !! 100 :: IO String</div>
<div>Prelude&gt; catch t f</div><div>&quot;*** Exception: Prelude.(!!): index too large</div><div><br></div><div>doesn&#39;t work.</div><div><br></div><div>kind regards,</div><div><br></div><div>Pieter</div><div><br></div>
<div><br></div><br><div class="gmail_quote">On Tue, Sep 9, 2008 at 10:35 PM, Pieter Laeremans <span dir="ltr">&lt;<a href="mailto:pieter@laeremans.org">pieter@laeremans.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div dir="ltr">Woops , I hit the &nbsp;&quot;send&quot; button to early.<div><br></div><div>The java approach to locate the error would be</div><div><br></div><div>try { &nbsp; ... }catch(Exception e ){&nbsp;</div><div>// log error&nbsp;</div>

<div>throw new RuntimeException(e);</div><div>}</div><div><br></div><div>...</div><div><br></div><div>What &#39;s the best equivalent haskell approach ?</div><div><br></div><div>thanks in advance,</div><div><br></div><font color="#888888"><div>

Pieter</div></font><div><div></div><div class="Wj3C7c"><div><br><br><div class="gmail_quote">On Tue, Sep 9, 2008 at 10:30 PM, Pieter Laeremans <span dir="ltr">&lt;<a href="mailto:pieter@laeremans.org" target="_blank">pieter@laeremans.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hello,<div><br></div><div>I&#39;ve written a cgi script in haskell, it crashes sometimes &nbsp;with the error message Prelude . tail &nbsp;: empty list<br clear="all"><br></div><div>In Java we would use this approach to log the erro&nbsp;</div>


<div><br></div><div>try {</div><div><br></div><div>} catch (Exception e) {</div><div><br></div><div><br></div><div>}</div><div><br></div><div><br>-- <br>Pieter Laeremans &lt;<a href="mailto:pieter@laeremans.org" target="_blank">pieter@laeremans.org</a>&gt;<br>


<br>&quot;The future is here. It&#39;s just not evenly distributed yet.&quot; W. Gibson<br>
</div></div>
</blockquote></div><br><br clear="all"><br>-- <br>Pieter Laeremans &lt;<a href="mailto:pieter@laeremans.org" target="_blank">pieter@laeremans.org</a>&gt;<br><br>&quot;The future is here. It&#39;s just not evenly distributed yet.&quot; W. Gibson<br>


</div></div></div></div>
</blockquote></div><br><br clear="all"><br>-- <br>Pieter Laeremans &lt;<a href="mailto:pieter@laeremans.org">pieter@laeremans.org</a>&gt;<br><br>&quot;The future is here. It&#39;s just not evenly distributed yet.&quot; W. Gibson<br>

</div></div>