
On 2002-10-05 at 18:41EDT David Roundy wrote:
How does one debug in haskell?
One doesn't. One writes correct code in Haskell ;-b
I have already isolated my bug within one function, but that function has somewhat funky recursion, and uses an array (which I'm none too familiar with in haskell), and there aren't any smaller parts that I can see to test. :(
More seriously: It seems to me likely that this function is too complicated for your current level of understanding (which probably means it's simply too complicated, full stop). Often, a better approach than trying to debug a function is to break the function into smaller parts using higher levels of abstraction. For example, you say that it involves "funky" recursion: perhaps it can be rewritten in terms of a fold or similar? In other words, can you abstract out the steps performed at each level of recursion (there may be several different steps depending on conditions)? You say it uses an array: can you use accumArray or accum? If you can break it up like this, it becomes easier to determine whether the individual parts are correct without resorting to debugging. Giving us a skek at the function in question might educe improved advice, too. Jón -- Jón Fairbairn Jon.Fairbairn@cl.cam.ac.uk 31 Chalmers Road jf@cl.cam.ac.uk Cambridge CB1 3SZ +44 1223 570179 (after 14:00 only, please!)