<div dir="ltr"><br><div>hlint does this to some extent (at least I have some copy-pasted code it keeps on pleading me to remove duplication).</div><div><br></div><div>Doug</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Dec 7, 2020 at 8:24 AM Johannes Waldmann <<a href="mailto:johannes.waldmann@htwk-leipzig.de">johannes.waldmann@htwk-leipzig.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">> very cool feature would be if I could select a program phrase<br>
> and let it find /similar/ phrases, where a similarity metric<br>
> could be edit-distance with respect to language tokens ...<br>
<br>
I often wanted a tool that finds (nearly) duplicate AST sub-trees<br>
in a large code base, and suggests refactorings.<br>
<br>
Of course, in an IDE, it could alert me on-the-fly<br>
that I'm typing some code that's already present elsewhere.<br>
<br>
How might one go about implementing this?<br>
Actual (approximate) sub-tree matching seems the easy part;<br>
but I have no clear idea about whether this<br>
should just use syntax, or needs types as well (my guess is: yes)<br>
what libraries are there to provide the (annotated) ASTs, etc.<br>
<br>
- J.W.<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
Only members subscribed via the mailman list are allowed to post.</blockquote></div>