[Haskell-cafe] Re: Haskell stacktrace

Pieter Laeremans pieter at laeremans.org
Tue Sep 9 17:06:43 EDT 2008


This :
Prelude> let f = (\x -> return "something went wrong")  ::   IOError -> IO
String
Prelude> let t = return $ show $ "too short list" !! 100 :: IO String
Prelude> catch t f
"*** Exception: Prelude.(!!): index too large

doesn't work.

kind regards,

Pieter



On Tue, Sep 9, 2008 at 10:35 PM, Pieter Laeremans <pieter at laeremans.org>wrote:

> Woops , I hit the  "send" button to early.
> The java approach to locate the error would be
>
> try {   ... }catch(Exception e ){
> // log error
> throw new RuntimeException(e);
> }
>
> ...
>
> What 's the best equivalent haskell approach ?
>
> thanks in advance,
>
> Pieter
>
>
> On Tue, Sep 9, 2008 at 10:30 PM, Pieter Laeremans <pieter at laeremans.org>wrote:
>
>> Hello,
>> I've written a cgi script in haskell, it crashes sometimes  with the error
>> message Prelude . tail  : empty list
>>
>> In Java we would use this approach to log the erro
>>
>> try {
>>
>> } catch (Exception e) {
>>
>>
>> }
>>
>>
>> --
>> Pieter Laeremans <pieter at laeremans.org>
>>
>> "The future is here. It's just not evenly distributed yet." W. Gibson
>>
>
>
>
> --
> Pieter Laeremans <pieter at laeremans.org>
>
> "The future is here. It's just not evenly distributed yet." W. Gibson
>



-- 
Pieter Laeremans <pieter at laeremans.org>

"The future is here. It's just not evenly distributed yet." W. Gibson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20080909/dc6d7fc0/attachment.htm


More information about the Haskell-Cafe mailing list