Michael Marte wrote:

frequently we are seeing messages like "List.head: empty list" or "Maybe.fromJust: Nothing". It is clear what happened and where the messages were triggered yet the real cause is usually VERY hard to find unless the program is small and simple. I came to the conclusion that functions like head and fromJust are best to be avoided because their use may render large programs unmaintainable. Instead I use irrefutable pattern matching like (x : _) = l and Just bla = maybeBla whenever possible because when a pattern match fails the ghc runtime system gives me a nice error message naming the module, line and column. However, this procedure may become tedious when the error occurs in a call to a third-party library function.

I wonder whether it is possible to print a "closure trace" similar to a stack trace in procedural programming.

Try compiling for profiling (-prof -auto-all) and running with +RTS -xc. If you're lucky, you'll get a stack trace.

The GHCi debugging project that Pepe Iborra is working on (Google summer of code) might address this issue, too.

Cheers,
        Simon
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to