It&#39;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">&lt;<a href="mailto:aslatter@gmail.com">aslatter@gmail.com</a>&gt;</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 &lt;<a href="mailto:paolo.veronelli@gmail.com">paolo.veronelli@gmail.com</a>&gt;:<br>
<div class="im">&gt; I think I&#39;ve got something nice in the end.<br>
&gt;<br>
&gt; <a href="http://hpaste.org/41042/classsynonymhs" target="_blank">http://hpaste.org/41042/classsynonymhs</a><br>
&gt;<br>
&gt; example:<br>
&gt;<br>
&gt; class&nbsp; (&nbsp;&nbsp;&nbsp; ParteDi (Servizio a) s<br>
&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ,&nbsp;&nbsp;&nbsp; Read a<br>
&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ,&nbsp;&nbsp;&nbsp; Eq a<br>
&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; , &nbsp;&nbsp;&nbsp; Show a<br>
&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; , &nbsp;&nbsp;&nbsp; Integer `ParteDi` s<br>
&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ) &rArr; SClass s a<br>
&gt;<br>
&gt; $(classSynonym &#39;&#39;SClass)<br>
&gt;<br>
&gt; ghci &quot;:i SClass&quot; command is printing some strange type variables but it<br>
&gt; compiles<br>
&gt;<br>
<br>
</div>Template Haskell might be overkill for this. In the past, I&#39;ve done:<br>
<br>
&gt; class (Eq b, Show b, MyClass b, MyOtherClass b) =&gt; MySynonym b<br>
&gt; instance (Eq b, Show b, MyClass b, MyOtherClass b) =&gt; 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>