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

Neil Mitchell ndmitchell at gmail.com
Wed Sep 6 17:38:39 EDT 2006


> 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 for the example of lookupJust still give a
crash, but have both the thing you were searching for and the list of
things you were searching in - lookupJust requires a Show, so can
usually tell you roughly where you are.

I also always write it out as Module.Name.function - since line 5 has
a habit of being moved to a different line a lot more than names

And because I am used to this, maybe 95% of all unsafe functions are
already in Note form, so I just change the new ones I added since last
time I broke down and cried.

However, its useful, but hacky. Its not something I should have to do manually.



More information about the Haskell-Cafe mailing list