<div>CafĂ©,</div><div><br></div><div>SYB-style libraries (and especially Uniplate) make it very easy to run generic</div><div>traversals (queries/transformations) on ADTs.</div><div><br></div><div>&gt; data Expr = ...</div>
<div>&gt; x :: Expr</div><div>&gt; f :: Expr -&gt; Expr</div><div>&gt; transform :: (Expr -&gt; Expr) -&gt; Expr -&gt; Expr</div><div>&gt; transform f x :: Expr -- applies f to x (and its children) in a bottom-up manner</div>
<div><br></div><div>Uniplate is very powerful and doesn&#39;t require any hand written type-class</div><div>instances to get going reasonably efficiently.</div><div><br></div><div>I can simply re-implement the functionality of Uniplate myself, modulo</div>
<div>requiring hand-written instances. (I didn&#39;t want to go into that road, since I</div><div>don&#39;t need it for this argument.)</div><div><br></div><div>I did this exercise, because I wanted to understand why we don&#39;t have similar</div>
<div>generic traversal libraries for GADTs. And, it didn&#39;t take long :)</div><div>I can post my trials but they are really baby steps and they wouldn&#39;t be</div><div>helpful.</div><div><br></div><div>My question is:</div>
<div><br></div><div>Considering how useful generic traversal libraries and GADTs are, has anybody</div><div>tried implementing a generic traversal library (like Uniplate or similar) for</div><div>GADTs? Is it a hard (or impossible, or not efficient, or problematic in some</div>
<div>other way) thing to implement, or is it just not a requirement for anyone</div><div>else?</div><div><br></div><div>Best,</div><div>Ozgur</div><div><br></div>