[Haskell-cafe] Printing call site for partial functions

Simon Marlow marlowsd at gmail.com
Thu Apr 26 09:50:40 CEST 2012


On 25/04/2012 17:28, Ozgur Akgun wrote:
 > Hi,
 >
 > On 25 April 2012 16:36, Michael Snoyman <michael at snoyman.com
 > <mailto:michael at snoyman.com>> wrote:
 >
 >         Prelude.head: empty list
 >
 >
 > Recent versions of GHC actually generate a very helpful stack trace, if
 > the program is compiled with profiling turned on and run with -xc.

Right.  Also don't forget to add -fprof-auto.

There's an API to get access to the stack trace too:

http://www.haskell.org/ghc/docs/latest/html/libraries/base-4.5.0.0/GHC-Stack.html

 > See: http://community.haskell.org/~simonmar/slides/HIW11.pdf
 > (Ironically titled "Prelude.head: empty list")

A more recent talk about this with more details is here:

http://community.haskell.org/~simonmar/Stack-traces.pdf


Cheers,
	Simon




More information about the Haskell-Cafe mailing list