Re: [Haskell-cafe] Re: Haskell stacktrace

2008-09-10 Thread Michał Pałka
I was going to suggest using the -xc option of the GHC runtime (if you are using GHC), but it seems that it doesn't always give meaningful results as indicated here: http://osdir.com/ml/lang.haskell.glasgow.bugs/2006-09/msg8.html and here:

[Haskell-cafe] Re: Haskell stacktrace

2008-09-09 Thread Pieter Laeremans
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

[Haskell-cafe] Re: Haskell stacktrace

2008-09-09 Thread Pieter Laeremans
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

Re: [Haskell-cafe] Re: Haskell stacktrace

2008-09-09 Thread Justin Bailey
2008/9/9 Pieter Laeremans [EMAIL PROTECTED]: What 's the best equivalent haskell approach ? thanks in advance, Pieter The preferred approach is to look at your code, figure out where you are using tail (or could be calling something that uses tail) and use the trace function to output logging

Re: [Haskell-cafe] Re: Haskell stacktrace

2008-09-09 Thread Ketil Malde
Justin Bailey [EMAIL PROTECTED] writes: are using tail (or could be calling something that uses tail) and use the trace function to output logging info. Another cheap trick is to use CPP with something like: #define head (\xs - case xs of { (x:_) - x ; _ - error(head failed at

Re: [Haskell-cafe] Re: Haskell stacktrace

2008-09-09 Thread C.M.Brown
Or define your own ghead and gtail: ghead msg [] = error ghead ++ msg ++ [] ghead _ (x:xs) = x gtail msg [] = error gtail ++ msg ++ [] gtail msg (x:xs) = xs and you can call them with a name of a function to give you an idea where the error is occurring: myHead = ghead myHead [] Chris.

Re: [Haskell-cafe] Re: Haskell stacktrace

2008-09-09 Thread Krzysztof Kościuszkiewicz
On Tue, Sep 09, 2008 at 11:06:43PM +0200, Pieter Laeremans wrote: 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 How about:

Re: [Haskell-cafe] Re: Haskell stacktrace

2008-09-09 Thread Alec Berryman
Justin Bailey on 2008-09-09 14:12:38 -0700: 2008/9/9 Pieter Laeremans [EMAIL PROTECTED]: What 's the best equivalent haskell approach ? thanks in advance, Pieter The preferred approach is to look at your code, figure out where you are using tail (or could be calling something that uses

[Haskell-cafe] Re: Haskell stacktrace

2008-09-09 Thread Peter Hercek
Justin Bailey wrote: 2008/9/9 Pieter Laeremans [EMAIL PROTECTED]: What 's the best equivalent haskell approach ? thanks in advance, Pieter The preferred approach is to look at your code, figure out where you are using tail (or could be calling something that uses tail) and use the trace

Re: [Haskell-cafe] Re: Haskell stacktrace

2008-09-09 Thread wren ng thornton
Pieter Laeremans wrote: 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. As others've said, the right answer is