> [...] > 2. Use the mapException trick to annotate exceptions as they > travel up the stack (see Alastair Reid's message). > [...] > (2) requires that you add lots of annotations to your code, so it's not > entirely satisfactory for that reason.
Would it be possible to generalise ghc's -prof-all mechanism so that annotations could be added automatically. For example, suppose I have an annotation function Debug.Callstack.callstack :: ModuleName -> LineNumber -> a -> a Then, if I compile with: ghc -annotate=Debug.Callstack.callstack Foo.hs then ghc could add import Debug.Callstack(callstack) to the import list and transform every top level function body as follows: foo (x:xs) = .. foo [] = ... => foo arg = callstack "Foo" -- module name 42 -- line number (foo' arg) foo' (x:xs) = .. foo' [] = .. -- Alastair _______________________________________________ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell