"instrumenting" functions

Ranjit Jhala jhala at cs.ucsd.edu
Thu Dec 1 16:56:07 UTC 2016


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!

Ranjit.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/glasgow-haskell-users/attachments/20161201/6c53af9d/attachment.html>


More information about the Glasgow-haskell-users mailing list