"instrumenting" functions

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

"instrumenting" functions

Ranjit Jhala
Hi all,

Given a module with top-level (functions) f1 ... fn, 
I would like to generate/compile an "instrumented" 
version where, say, each function prints the string 
"hello", every time it is called.

Can anyone suggest some ways of doing this? 
One option is a core-to-core transform with an 
    unsafePerformIO (print "hello")

stuck into the appropriate places. But perhaps there 
are better ways? Ideally I'd like to instrument each 
"App" to log every function application.

Are other libraries or tools that use the GHC API 
to do this sort of thing? 

Thanks in advance!


Glasgow-haskell-users mailing list
[hidden email]