I don't know what you actually need, but if haskell-src-exts is an option, it is quite a bit easier to use (definitely easier to understand for me!). Especially when used together with Uniplate.
For example, for a given piece of AST one can get all the identifiers used like so:
[ x | Ident x <- universeBi ast ]
Uniplate isn't a powerful enough generic system to design a full refactoring engine, as we need top down/bottom up/ full/stop/once plus preservation and unification, much in the style of Strafunski. I think SYB is better for our needs. Perhaps we could use a combination of uniplate+SYB depending on what traversals/rewrites we need to do.
Finding where they are bound shouldn't be very hard either.
No, but it would be much easier if the information was already there, of course! :)
Thanks for your response!
Chris.
Hope this helps,
Ozgur
On 23 January 2012 17:33, Christopher Brown
<cmb21@st-andrews.ac.uk> wrote:
Hi,
I was wondering if anyone could tell me if it's possible to get an AST from the ghc-api decorated with static-semantics?
In particular, I am interested in use and bind locations for all names in the AST together with the module they are bound, etc.
Looking through the online docs, there doesn't seem to be a way to do this.
Even if I can tell from the AST where a variable is bound that would be enough, if this is by making all names unique and qualified that would be better than nothing.
Hope someone can help,
Chris.