
6 Nov
2012
6 Nov
'12
5:33 p.m.
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...). It basically allows you to add some temporary debug print to your code. I find it particularly useful that "empty list" exception.