[Haskell-beginners] exceptions and stacks
Amy de Buitléir
amy at nualeargais.ie
Tue Nov 6 18:33:46 CET 2012
Yes, I've had similar problems with that %$#*! "*** Exception: Prelude.head:
empty list" exception. When I was newer to Haskell, I was very worried about how
often I might encounter that sort of problem. If it gives you any hope or
comfort, over time I haven't found this to be much too of a problem in practice.
In addition to the debugger, another valuable tool is Debug.Trace (see
http://hackage.haskell.org/packages/archive/base/latest/doc/html/Debug-Trace.html).
It basically allows you to add some temporary debug print to your code. I find
it particularly useful that "empty list" exception.
More information about the Beginners
mailing list