As part of a research project on property-based testing, I need to do static whole-program analysis of Haskell programs. I'm looking for suggestions on how to implement whole-program analysis of Haskell programs, hopefully without building lots of infrastructure myself.
I looked at Template Haskell, which has many of the capabilities I need, but is missing a key feature: in Template Haskell as implemented in GHC, there appears to be no way to get the definition of a function by name. (Related SO question: How to get the declaration of a function using `reify`?)
I suspect that there might be some way of doing whole-program analysis of Haskell programs using the GHC API, but I can't easily determine how this might be done from the GHC API documentation.
In particular, given a function call site, I need to be able to look up the corresponding function definition(s). I'm especially interested in Template Haskell or GHC API-based solutions.
Is there any way to do whole-program analysis of Haskell programs without building all the infrastructure myself?