Data and Typeable instances for GenericPackageDescription
jpmoresmau at gmail.com
Wed Jun 16 03:03:09 EDT 2010
On Tue, Jun 15, 2010 at 8:48 PM, Edward Z. Yang <ezyang at mit.edu> wrote:
> Excerpts from JP Moresmau's message of Tue Jun 15 14:43:28 -0400 2010:
> > Hello, I was wondering if there are instances for Typeable and Data
> > available somewhere for GenericPackageDescription. Automatic deriving
> > fails, probably, if I read the docs right, because some types in there
> > have more than 7 parameters. It would help me to use the cabal file
> > parsing functions and convert the result automatically to JSON for use
> > in Eclipse through Scion. Of course if there isn't I suppose I can
> > write my own instances and maybe share them with who ever is
> > interested.
> I'd like to second this request; I've written some code that digs for
> data in these structures and Typeable and Data instances would help
> eliminate some of the boilerplate associated with this task.
Unfortunately, using derive and Template Haskell to add these instances
"from the outside" fails, for only one minute thing: ModuleName does not
export its constructor! I have added the export (on the 1.9.2 darcs version)
and I can successfully generated Data instances. So it looks like we'll
need to change the code in Cabal itself, either to add that export, or to
add deriving/instance clauses on the relevant types. The minimal impact
would be to add deriving Data,Typeable to ModuleName and use derive for the
rest, maybe in another llibrary, if adding all these clauses on all the
types has too much impact.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cabal-devel