The package monadloc defines a class for monads which can keep a monadic call trace.
See the blog post http://pepeiborra.wordpress.com/2009/11/01/monadic-stack-traces-that-make-a-lot-of-sense/ for more information.
This package provides a preprocessor that inserts calls
to Control.Monad.Loc.withLoc before every monadic statement in a module.
To invoke the preprocessor, add the pragma OPTIONS_GHC -F -pgmF MonadLoc at the top of your Haskell files together with an import for the Control.Monad.Loc module