It's first time I use TH. It would be nice to point out the motivations for using it.<br>If everything TH does is doable without it, the point of using it is write less code, eliminating some necessary and automatically computable code.<br>
But I guess there is some more .....<br><br>paolino<br><br><div class="gmail_quote">2010/11/2 Antoine Latter <span dir="ltr"><<a href="mailto:aslatter@gmail.com">aslatter@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
2010/11/1 Paolino <<a href="mailto:paolo.veronelli@gmail.com">paolo.veronelli@gmail.com</a>>:<br>
<div class="im">> I think I've got something nice in the end.<br>
><br>
> <a href="http://hpaste.org/41042/classsynonymhs" target="_blank">http://hpaste.org/41042/classsynonymhs</a><br>
><br>
> example:<br>
><br>
> class ( ParteDi (Servizio a) s<br>
> , Read a<br>
> , Eq a<br>
> , Show a<br>
> , Integer `ParteDi` s<br>
> ) ⇒ SClass s a<br>
><br>
> $(classSynonym ''SClass)<br>
><br>
> ghci ":i SClass" command is printing some strange type variables but it<br>
> compiles<br>
><br>
<br>
</div>Template Haskell might be overkill for this. In the past, I've done:<br>
<br>
> class (Eq b, Show b, MyClass b, MyOtherClass b) => MySynonym b<br>
> instance (Eq b, Show b, MyClass b, MyOtherClass b) => MySynonym b<br>
<br>
I think this requires a couple of GHC extensions, but TemplateHaskell<br>
is an extension as well. Maybe there are pitfalls with this approach.<br>
<font color="#888888"><br>
Antoine<br>
</font></blockquote></div><br>