[Haskell-cafe] Prelude.head: empty list

Francesco Ariis fa-ml at ariis.it
Fri Mar 11 18:26:47 UTC 2016

On Fri, Mar 11, 2016 at 04:56:57PM +0100, Han Joosten wrote:
> In a rather large program I made some changes, and now I get the runtime
> error:
> ampersand.exe: Prelude.head: empty list
> Of course I know that head is partial, and should be used with care. It is
> used many times (we have 100+ modules in the program). Is there an elegant
> way to get some information about where the specific call to head is being
> made?
> Thanks!

I scanned previous replies and didn't see it mentioned, maybe you can
abuse C preprocessor to shadow `head` and insert a __LINE__ on
pattern matching []?

More information about the Haskell-Cafe mailing list