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
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@haskell.org [mailto:template-haskell-bounces@haskell.org] On Behalf Of Alfonso | Acosta | Sent: 30 October 2007 01:43 | To: template-haskell@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
Forgot to send this answer to the list, sorry.
On 11/1/07, Simon Peyton-Jones
Make a Trac feature request?
I'll be happy to do it.
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.
That's exactly what my patch+new module are supposed to do. I'm still waiting for Ian to review it and maybe include them in his library. Besides, since automatic instantiation of Lift seems to be a basic need for a TH programmer, Wouldn't it be a good idea to merge th-lift with the mainstream template-haskell library? Cheers, Fons
participants (2)
-
Alfonso Acosta -
Simon Peyton-Jones