<div dir="ltr">This :<div><br></div><div><div>Prelude> let f = (\x -> return "something went wrong") :: IOError -> IO String</div><div>Prelude> let t = return $ show $ "too short list" !! 100 :: IO String</div>
<div>Prelude> catch t f</div><div>"*** Exception: Prelude.(!!): index too large</div><div><br></div><div>doesn'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"><<a href="mailto:pieter@laeremans.org">pieter@laeremans.org</a>></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 "send" button to early.<div><br></div><div>The java approach to locate the error would be</div><div><br></div><div>try { ... }catch(Exception e ){ </div><div>// log error </div>
<div>throw new RuntimeException(e);</div><div>}</div><div><br></div><div>...</div><div><br></div><div>What '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"><<a href="mailto:pieter@laeremans.org" target="_blank">pieter@laeremans.org</a>></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've written a cgi script in haskell, it crashes sometimes with the error message Prelude . tail : empty list<br clear="all"><br></div><div>In Java we would use this approach to log the erro </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 <<a href="mailto:pieter@laeremans.org" target="_blank">pieter@laeremans.org</a>><br>
<br>"The future is here. It's just not evenly distributed yet." W. Gibson<br>
</div></div>
</blockquote></div><br><br clear="all"><br>-- <br>Pieter Laeremans <<a href="mailto:pieter@laeremans.org" target="_blank">pieter@laeremans.org</a>><br><br>"The future is here. It's just not evenly distributed yet." W. Gibson<br>
</div></div></div></div>
</blockquote></div><br><br clear="all"><br>-- <br>Pieter Laeremans <<a href="mailto:pieter@laeremans.org">pieter@laeremans.org</a>><br><br>"The future is here. It's just not evenly distributed yet." W. Gibson<br>
</div></div>