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:
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
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
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
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
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.
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:
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
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
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
10 matches
Mail list logo