
Folks, I'm a rank beginner in Haskell, and though Haskell seems like a great language to start using, I've got a serious concern about debugging. In about 15 years of Lisp experience, then 15 years of C++, I've gotten pretty accustomed to the idea of using a debugger with lots of pre- and post-conditions on functions, breakpoints, stack trace, and variable inspection -- even though it gets tricky with delayed evaluation, macros, etc. in Lisp! So I don't understand how serious programmers can work on large projects in Haskell with nothing but compiler type-checking and QuickCheck. Yet they get it done, so I must be missing something. Things like the Haskell version of Eclipse seem to provide nothing but syntax coloring and pass-through to 'make': no break points, stack trace, or variable inspection that I can find. Is there some serious IDE (even "emacs + gdb" is serious enough for me) I'm missing? Do Haskell shops develop their own home-grown tools, or do they do something completely different? -- Ben P. Wise, PhD GPG: 0xCAF514E1

On Tue, Jul 21, 2009 at 09:26:19AM -0400, Ben Wise wrote:
Folks,
I'm a rank beginner in Haskell, and though Haskell seems like a great language to start using, I've got a serious concern about debugging.
In about 15 years of Lisp experience, then 15 years of C++, I've gotten pretty accustomed to the idea of using a debugger with lots of pre- and post-conditions on functions, breakpoints, stack trace, and variable inspection -- even though it gets tricky with delayed evaluation, macros, etc. in Lisp!
If you think it's tricky in Lisp, it's about ten times as tricky with a lazy language like Haskell! Using gdb with Haskell executables is pretty much useless since the generated code doesn't correspond to the Haskell code in any obvious ways. And it's really hard to make traditional debuggers since the ghc runtime model looks nothing like traditional ones. However, There IS a debugger built into most recent versions of ghci which lets you do some of these things -- have you taken a look at that? I've done quite a bit of programming using the sort of debuggers you describe myself---with C, C++, and Java in particular. And yet in all the Haskell coding I've done over the past few years---some of it quite significant---I've rarely missed those sorts of debuggers. I'm not quite sure I understand the reason why. Perhaps it's partly because Haskell lets you program on such a high level that there's less room for the sorts of titchy errors that debuggers are so good at helping you find. In any case, I wouldn't worry about it too much at this point if I were you, and if you really do find yourself wanting it, take a look at the ghci debugger. -Brent

I, for one, have never found a need for a more traditional debugger in haskell. Most of my 'bugs' are more accurately described as 'behavior which I did not intend' rather than the more normal description of 'behavior which breaks things'. That is, Haskell programs (almost) always work if they type-check, however, they may work in a way you had not planned on. :) /Joe Brent Yorgey wrote:
On Tue, Jul 21, 2009 at 09:26:19AM -0400, Ben Wise wrote:
Folks,
I'm a rank beginner in Haskell, and though Haskell seems like a great language to start using, I've got a serious concern about debugging.
In about 15 years of Lisp experience, then 15 years of C++, I've gotten pretty accustomed to the idea of using a debugger with lots of pre- and post-conditions on functions, breakpoints, stack trace, and variable inspection -- even though it gets tricky with delayed evaluation, macros, etc. in Lisp!
If you think it's tricky in Lisp, it's about ten times as tricky with a lazy language like Haskell! Using gdb with Haskell executables is pretty much useless since the generated code doesn't correspond to the Haskell code in any obvious ways. And it's really hard to make traditional debuggers since the ghc runtime model looks nothing like traditional ones. However, There IS a debugger built into most recent versions of ghci which lets you do some of these things -- have you taken a look at that?
I've done quite a bit of programming using the sort of debuggers you describe myself---with C, C++, and Java in particular. And yet in all the Haskell coding I've done over the past few years---some of it quite significant---I've rarely missed those sorts of debuggers. I'm not quite sure I understand the reason why. Perhaps it's partly because Haskell lets you program on such a high level that there's less room for the sorts of titchy errors that debuggers are so good at helping you find. In any case, I wouldn't worry about it too much at this point if I were you, and if you really do find yourself wanting it, take a look at the ghci debugger.
-Brent _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
participants (3)
-
Ben Wise
-
Brent Yorgey
-
Joe Fredette