[Template-haskell] Lift instances of the AST-related types
Simon Peyton-Jones
simonpj at microsoft.com
Thu Nov 1 10:07:40 EDT 2007
Make a Trac feature request? As usual that doesn't guaranteed it'll get done, but it saves it getting forgotten.
Using TH to generate the Lift instances seems like the right way to go -- it's what TH is for, and it's 95% as good as deriving( Lift ).
Augmenting Ian's library so that when you got the library you thereby got the Lift instances (themselves generated by the library) for the TH data types.
In that way the whole thing could be done by modifying Ian's library without touching GHC, which is always good.
Simon
| -----Original Message-----
| From: template-haskell-bounces at haskell.org [mailto:template-haskell-bounces at haskell.org] On Behalf Of Alfonso
| Acosta
| Sent: 30 October 2007 01:43
| To: template-haskell at haskell.org
| Subject: [Template-haskell] Lift instances of the AST-related types
|
| Hi,
|
| It has been suggested a few types in this list [1,2] that it would be
| helpful to include a Lift instance of Exp, Type, Dec and friends.
|
| Having such instances allow to store the AST in a TH-generated
| structure for later processing during runtime (something curcial in
| the embedded compiler I'm currently developing).
|
| It would be great that the instances were included in the library
| itself or if (even better) GHC supported automatic deriving of Lift.
|
| Until that happens, I have used a modified version Ian's th-lift[3] to
| automatically generate the instances.
|
| Just in case anyone is interested, I attached the patch of th-lift and
| the instantiation module.
|
| Cheers,
|
| Fons
|
|
| [1] http://www.haskell.org/pipermail/template-haskell/2007-February/000593.html
| [2] http://www.haskell.org/pipermail/template-haskell/2004-June/000289.html
| [3] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/th-lift-0.2
More information about the template-haskell
mailing list