[Haskell] modern language design, stone age tools
Alastair Reid
alastair at reid-hoffmann.net
Thu Jun 24 05:30:59 EDT 2004
> [...]
> 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
More information about the Haskell
mailing list