<div><br><br><div class="gmail_quote">On Thu, Jun 17, 2010 at 1:21 AM, Duncan Coutts <span dir="ltr">&lt;<a href="mailto:duncan.coutts@googlemail.com">duncan.coutts@googlemail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Tue, 2010-06-15 at 20:43 +0200, JP Moresmau wrote:<br>
&gt; Hello, I was wondering if there are instances for Typeable and Data<br>
&gt; available somewhere for GenericPackageDescription. Automatic deriving<br>
&gt; fails, probably, if I read the docs right, because some types in there<br>
&gt; have more than 7 parameters. It would help me to use the cabal file<br>
&gt; parsing functions and convert the result automatically to JSON for use<br>
&gt; in Eclipse through Scion. Of course if there isn&#39;t I suppose I can<br>
&gt; write my own instances  and maybe share them with who ever is<br>
&gt; interested.<br>
<br>
</div>I&#39;m happy to accept patches.<br>
<br>
One thing to keep in mind is that the Cabal library must be compilable<br>
with hugs and nhc98 as well as ghc. I think that means we cannot use<br>
deriving Typeable or Data since, as far as I know, neither of those<br>
compilers supports that language extension.<br>
<br>
Note that the ModuleName constructor is not exported on purpose. Do Data<br>
instances make sense for abstract types?<br>
<font color="#888888"><br>
Duncan<br>
<br>
</font></blockquote></div><br>Yes, I&#39;ve managed to specify a Data instance for ModuleName without touching the Cabal source code (using fromString instead of a constructor). So I can either do them by end for all of them and put that in the Cabal code, and test for every supported compiler, or we can just put the instances (the explicit ModuleName and the derive generated ones for all the other) in a separate library that people can use when they need that functionality, that can require all these dependencies that we don&#39;t want Cabal to have (TH + derive). Second option is easier (-: I can tell from hackage that it&#39;s not unusual to have libraries only providing instances.<div>
As an aside, ModuleName is the only problematic constructor in 1.8 or 1.9, as far as I can tell.</div><br>-- <br>JP Moresmau<br><a href="http://jpmoresmau.blogspot.com/">http://jpmoresmau.blogspot.com/</a><br>
</div>