<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Ozgur,<div><br></div><div>Yes I've looked at haskell-src-exts and it does look *much* easier to use.</div><div><br></div><div>I need this to build a new refactoring tool for Haskell (for the Paraphrase project). One advantage to using the ghc-api directly</div><div>is that's it's always cutting edge and maintained by the ghc team. Having one more library dependancy to worry about is not always a good thing.</div><div><br></div><div>At the moment (and spending half a day yesterday just working out how to 'show' an AST from the ghc-api) I'm veering towards haskell-src-exts. I think extending it to contain use and bind locations in the AST would be the best option for me. There's also a question of having types in the AST as well.</div><div><br></div><div><div><blockquote type="cite"><div>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.</div>

<div><br></div><div>For example, for a given piece of AST one can get all the identifiers used like so:</div><div><br></div><div>[ x | Ident x &lt;- universeBi ast ]</div><div><br></div></blockquote><div><br></div><div>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.</div><div><br></div><br><blockquote type="cite"><div>Finding where they are bound shouldn't be very hard either.</div>

<div><br></div></blockquote><div><br></div><div>No, but it would be much easier if the information was already there, of course! :)</div><div><br></div><div><br></div><div>Thanks for your response!&nbsp;</div><div>Chris.</div><div><br></div><blockquote type="cite"><div>Hope this helps,</div><div>Ozgur<br><br><div class="gmail_quote">On 23 January 2012 17:33, Christopher Brown <span dir="ltr">&lt;<a href="mailto:cmb21@st-andrews.ac.uk">cmb21@st-andrews.ac.uk</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I was wondering if anyone could tell me if it's possible to get an AST from the ghc-api decorated with static-semantics?<br>
In particular, I am interested in use and bind locations for all names in the AST together with the module they are bound, etc.<br>
<br>
Looking through the online docs, there doesn't seem to be a way to do this.<br>
Even if I can tell from the AST where a variable is bound that would be enough, &nbsp;if this is by making all names unique and qualified that would be better than nothing.<br>
<br>
Hope someone can help,<br>
Chris.<br></blockquote></div>
</div>
</blockquote></div><br></div></body></html>