On Sun, Sep 4, 2011 at 13:03, Roman Cheplyaka wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">* Sean Leather [2011-09-04 12:48:38+0200]<br>
<div><div></div><div class="h5">> On Sun, Sep 4, 2011 at 12:31, Roman Cheplyaka wrote:<br>
><br>
> > I'm looking for an example of idiomatic usage of the fixpoint library[1].<br>
> ><br>
> > [1]: <a href="http://hackage.haskell.org/package/fixpoint-0.1.1" target="_blank">http://hackage.haskell.org/package/fixpoint-0.1.1</a><br>
><br>
><br>
> I'm not sure if this counts for idiomatic usage, but you can check out<br>
> our approach to incrementalization.<br>
><br>
> <a href="http://people.cs.uu.nl/andres/Incrementalization/" target="_blank">http://people.cs.uu.nl/andres/Incrementalization/</a><br>
<br>
</div></div>Yeah, it has more or less the same problems as my code above.<br>
<br>
You essentially defined your tree twice (Tree and F (Tree)).<br>
For such a simple type it's fine, but if it was an AST with a few<br>
dozens of constructors, such approach would be unacceptable.<br></blockquote><div><br></div><div>True. Technically, one doesn't need Expr or Tree, right? But if you prefer to define your datatype that way, that's usually where I turn to code generation, possibly using Template Haskell, Data.Derive, or something else.</div>
<div><br></div><div>Sean</div></div>