[Haskell] ANNOUNCE: control-monad-exception 0.5 with monadic call traces

Jose Iborra pepeiborra at gmail.com
Mon Nov 2 17:53:38 EST 2009


I'm happy to announce a new release of control-monad-exception with  
monadic call traces,
available in Hackage. Grab it now while it is still online!

Monadic stack traces are described in detail in a blog post [1].

In short, what this means for your code is the ability to generate  
errors like this:

500 Internal Server Error
The CGI server failed with the following error:
DeleteException (BmPK 2009-10-26 19:39:51.031297 UTC "Testing RPO")
  in deleteBenchmarkFromPK, NarradarBenchmarkDB(src/ 
NarradarBenchmarkDB.hs): (186, 44)
     deleteBenchmarkFromPK, NarradarBenchmarkDB(src/ 
NarradarBenchmarkDB.hs): (186, 25)
     deleteBenchmarkFromPK, NarradarBenchmarkDB(src/ 
NarradarBenchmarkDB.hs): (184, 17)
     deleteBenchmarkFromPK, NarradarBenchmarkDB(src/ 
NarradarBenchmarkDB.hs): (180, 90)
     deleteTests, NarradarBenchmarkCGI(src/NarradarBenchmarkCGI.hs):  
(108, 3)
     deleteTests, NarradarBenchmarkCGI(src/NarradarBenchmarkCGI.hs):  
(106, 20)
     cgiMain, NarradarBenchmarkCGI(src/NarradarBenchmarkCGI.hs): (52,  
     cgiMain, NarradarBenchmarkCGI(src/NarradarBenchmarkCGI.hs): (52,  
     cgiMain, NarradarBenchmarkCGI(src/NarradarBenchmarkCGI.hs): (50, 9)
     cgiMain, NarradarBenchmarkCGI(src/NarradarBenchmarkCGI.hs): (46,  

Currently a preprocessor is used to insert the source location  
information in the
right places. The preprocessor is invoked by including the following  
pragma at
the top of your Haskell source files:

{-# OPTIONS_GHC -F -pgmF MonadLoc #-}

In addition, you need to be in a monad which implements the Monadloc  
currently the EMT monad from control-monad-exception being the only one,
although it is trivial to enhance any error monad to implement this  

In addition, support for monadic stack traces could be built into GHC  
  1. No preprocessor would be needed.
  2. Eventually the IO monad could be enhanced to provide stack traces  
like this.

Enjoy your monadic call traces !

Pepe Iborra

[1] - http://pepeiborra.posterous.com/monadic-stack-traces-that-make-a-lot-of-sense

More information about the Haskell mailing list