Re: [Haskell-cafe] Re: how do you debug programs?

2006-09-07 Thread Claus Reinke
thinking helps, but claiming that tools can't help doesn't. Lets be absolutely clear about this: I've never claimed that tools can't help. In this thread I've been using the term debugger in the narrow sense implied by the OP's question -- something that steps through the execution of the

Re: [Haskell-cafe] Re: how do you debug programs?

2006-09-07 Thread David Roundy
On Thu, Sep 07, 2006 at 06:21:01AM +0100, Jn Fairbairn wrote: David Roundy [EMAIL PROTECTED] writes: On Wed, Sep 06, 2006 at 09:56:17AM -0700, Jason Dagit wrote: Or maybe even more extreme you could use template haskell or the c preprocessor to fill in the line number + column.

[Haskell-cafe] Re: how do you debug programs?

2006-09-06 Thread Jón Fairbairn
Tamas K Papp [EMAIL PROTECTED] writes: I would like to learn a reasonable way (ie how others do it) to debug programs in Haskell. Is it possible to see what's going on when a function is evaluated? Eg in f a b = let c = a+b d = a*b in c+d evaluating f 1 2

Re: [Haskell-cafe] Re: how do you debug programs?

2006-09-06 Thread Neil Mitchell
Hi But why should c and d exist at runtime? They're only used once each, so the compiler is free to replace f with \a b - (a+b)+ a*b Yes, and if the compiler is this clever, it should also be free to replace them back at debug time. I've said this before, but I think it's worth repeating:

Re: [Haskell-cafe] Re: how do you debug programs?

2006-09-06 Thread Lennart Augustsson
I've also used Visual Studio, and I wouldn't mind having something like that for Haskell. But I have to agree with Jon, I think the best way of debugging is to understand your code. I think people who come from imperative programming come with a mind set that you understand your code by

Re: [Haskell-cafe] Re: how do you debug programs?

2006-09-06 Thread Tamas K Papp
On Wed, Sep 06, 2006 at 06:33:32AM -0400, Lennart Augustsson wrote: I've also used Visual Studio, and I wouldn't mind having something like that for Haskell. But I have to agree with Jon, I think the best way of debugging is to understand your code. I think people who come from

Re: [Haskell-cafe] Re: how do you debug programs?

2006-09-06 Thread Ketil Malde
Tamas K Papp [EMAIL PROTECTED] writes: Most of the mistakes I make are related to indentation, I use Emacs, which has a reasonably decent mode for this. Hit TAB repeatedly to show the possible indentations. precedence (need to remember that function application binds tightly). It's not

[Haskell-cafe] Re: how do you debug programs?

2006-09-06 Thread Jón Fairbairn
Neil Mitchell [EMAIL PROTECTED] writes: Hi But why should c and d exist at runtime? They're only used once each, so the compiler is free to replace f with \a b - (a+b)+ a*b Yes, and if the compiler is this clever, it should also be free to replace them back at debug time. And

Re: [Haskell-cafe] Re: how do you debug programs?

2006-09-06 Thread Neil Mitchell
Hi Yes, and if the compiler is this clever, it should also be free to replace them back at debug time. And where does that get us? You snipped the salient bit where I said that you'd be debugging a different programme. In Visual C there are two compilation modes. In debug mode, if you

[Haskell-cafe] Re: how do you debug programs?

2006-09-06 Thread Jón Fairbairn
Tamas K Papp [EMAIL PROTECTED] writes: On Wed, Sep 06, 2006 at 06:33:32AM -0400, Lennart Augustsson wrote: I've also used Visual Studio, and I wouldn't mind having something like that for Haskell. But I have to agree with Jon, I think the best way of debugging is to understand your

Re: [Haskell-cafe] Re: how do you debug programs?

2006-09-06 Thread Andrae Muys
On 06/09/2006, at 8:22 PM, Neil Mitchell wrote:It's been my experience that debugging is a serious weakness ofHaskell - where even the poor mans printf debugging changes thesemantics! And everyone comes up with arguments why there is no needto debug a functional language - that sounds more like

[Haskell-cafe] Re: how do you debug programs?

2006-09-06 Thread Jón Fairbairn
Neil Mitchell [EMAIL PROTECTED] writes: Hi Yes, and if the compiler is this clever, it should also be free to replace them back at debug time. And where does that get us? You snipped the salient bit where I said that you'd be debugging a different programme. In Visual C there

Re: [Haskell-cafe] Re: how do you debug programs?

2006-09-06 Thread Neil Mitchell
Hi I think that when it comes to debuggers and Haskell its fairly safe to say: 1) There aren't any which are production quality, regularly work out of the box and are avaiable without much effort. There may be ones which are debuggers (Hat/GHCi breakpoints), but we probably haven't got to the

[Haskell-cafe] Re: how do you debug programs?

2006-09-06 Thread Stefan Monnier
I simply can't let this pass without comment. It's irrelevant if you're using a functional or imperative language, debuggers are invariably a waste of time. The only reason to use a debugger is because you need to inspect the contents of a processes address-space; That's a very narrow

Re: [Haskell-cafe] Re: how do you debug programs?

2006-09-06 Thread Pepe Iborra
On 06/09/2006, at 17:10, Andrae Muys wrote:On 06/09/2006, at 8:22 PM, Neil Mitchell wrote:It's been my experience that debugging is a serious weakness ofHaskell - where even the poor mans printf debugging changes thesemantics! And everyone comes up with arguments why there is no needto debug a

Re: [Haskell-cafe] Re: how do you debug programs?

2006-09-06 Thread Malcolm Wallace
Andrae Muys [EMAIL PROTECTED] wrote: It's a truism to say if your code doesn't work it's because you don't understand it; ... Indeed, but tracing the execution of the code, on the test example where it fails, will often give insight into one's misunderstanding. And often, the person trying

Re: [Haskell-cafe] Re: how do you debug programs?

2006-09-06 Thread Jason Dagit
On 9/6/06, Neil Mitchell [EMAIL PROTECTED] wrote: Let take for example a bug I spent tracking down in Haskell this weekend. The bug can be summarized as Program error: pattern match failure: head []. And indeed, thats all you get. A quick grep reveals there are about 60 calls to head in the

[Haskell-cafe] Re: how do you debug programs?

2006-09-06 Thread Johan Tibell
Note: I meant to send this to the whole list a couple of messages ago but accidentally I only sent it to Lennart, sorry Lennart! I know that Linus Torvalds doesn't find debuggers all that useful either and he hacks C [1]. 1. http://linuxmafia.com/faq/Kernel/linus-im-a-bastard-speech.html On

Re: [Haskell-cafe] Re: how do you debug programs?

2006-09-06 Thread David Roundy
On Wed, Sep 06, 2006 at 09:56:17AM -0700, Jason Dagit wrote: Or maybe even more extreme you could use template haskell or the c preprocessor to fill in the line number + column. Which is precisely what darcs does for fromJust (which we use a lot): we define a C preprocessor macro fromJust.

Re: [Haskell-cafe] Re: how do you debug programs?

2006-09-06 Thread Chris Kuklewicz
David Roundy wrote: On Wed, Sep 06, 2006 at 09:56:17AM -0700, Jason Dagit wrote: Or maybe even more extreme you could use template haskell or the c preprocessor to fill in the line number + column. Which is precisely what darcs does for fromJust (which we use a lot): we define a C

Re: [Haskell-cafe] Re: how do you debug programs?

2006-09-06 Thread Neil Mitchell
Hi I don't know what your getout plan was but when I'm in this situation I do the following (hopefully listing this trick will help the OP): I have headNote, fromJustNote, fromJustDefault, lookupJust, lookupJustNote, tailNote - a whole set of functions which take an extra note parameter - or

[Haskell-cafe] Re: how do you debug programs?

2006-09-06 Thread Aaron Denney
On 2006-09-06, Andrae Muys [EMAIL PROTECTED] wrote: Jon understates it by implying this is a Functional/Haskell specific quality - it's not. Debuggers stopped being useful the day we finally delegated pointer handling to the compiler/vm author and got on with writing code that actually

Re: [Haskell-cafe] Re: how do you debug programs?

2006-09-06 Thread Claus Reinke
scientists, who ought to know, assure us that it must be so, oh, let us never, never, doubt, what nobody is sure about. (or something like that..;-) as everyone else in this thread, I have my own experiences and firm opinions on the state of debugging support in Haskell (in particular on the

[Haskell-cafe] Re: how do you debug programs?

2006-09-06 Thread Jón Fairbairn
Claus Reinke [EMAIL PROTECTED] writes: thinking helps, but claiming that tools can't help doesn't. Lets be absolutely clear about this: I've never claimed that tools can't help. In this thread I've been using the term debugger in the narrow sense implied by the OP's question -- something that

[Haskell-cafe] Re: how do you debug programs?

2006-09-06 Thread Jón Fairbairn
David Roundy [EMAIL PROTECTED] writes: On Wed, Sep 06, 2006 at 09:56:17AM -0700, Jason Dagit wrote: Or maybe even more extreme you could use template haskell or the c preprocessor to fill in the line number + column. Which is precisely what darcs does for fromJust (which we use a lot):