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

Neil Mitchell ndmitchell at gmail.com
Wed Sep 6 06:22:10 EDT 2006


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: in
> most cases, if you need to debug your programme it's because
> it's too complicated for you to understand, so the correct
> thing to do is to simplify it and try again.

That makes it impossible to ever improve - initially all programs are
beyond you, and only by pushing the boundary do you get anywhere. As
for me, I always write programs I can't understand, and that no one
else can. Perhaps I understood it when I originally wrote it, perhaps
not, but that was maybe over a year ago.

It's been my experience that debugging is a serious weakness of
Haskell - where even the poor mans printf debugging changes the
semantics! And everyone comes up with arguments why there is no need
to debug a functional language - that sounds more like excuses about
why we can't build a good lazy debugger :)

[Sorry for the slight rant, but I've used Visual Studio C++ so I know
what a good debugger looks like, and how indispensable they are]

Thanks

Neil


More information about the Haskell-Cafe mailing list