fernanbolando:
> 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.

You could:

    * use Debug.Trace.trace  (equivalent of printf debugging)
    * use asserts: the 'assert' function
    * use the GHCi debugger to construct a stack trace
    * use profiling to construct a stack trace.
    * use the GHC head branch for first class stack traces, described
          in, "Finding the needle: Stack Traces for GHC"
                
http://pubs.doc.ic.ac.uk/finding-the-needle/finding-the-needle.pdf

-- Don

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

Reply via email to