Fernan Bolando <fernanbola...@mailc.net> writes:

> Hi all
>
> I recently used 2 hours of work looking for a bug that was causing
>
> Program error: Prelude.!!: index too large
>
> This is not very informative. It did not give me a hint which function
> was causing this. In C adding a few printf would have helped me, but
> in haskell I was not sure how to do that. Can anybody point me to some
> debuggin method everyone uses.
>
> After 2 hours I did find the bug eventually. The code can be viewed here.
> Maybe some reformatting of the code would make finding bugs easier?
> http://plan9.bell-labs.com/sources/contrib/fernan/escomma/

I wonder if your code has to use !! at all? I took a look at a random
module from the above link, and (without making much attempt at
understanding it), I'd guess that using accumArray and friends would be
more appropriate. Mostly you don't want to be doing indexing on lists.

-- 
Jón Fairbairn                                 jon.fairba...@cl.cam.ac.uk


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to