RE: [Template-haskell] TH preprocessing
Not at present. It's actually a little trickier than it looks, because the post-type-checked program (with the splices expanded) has dictionary stuff floating around, and it's not entirely straightforward to convert it back to vanilla source Haskell. You're right it would be useful. I think it's feasible with a bit of work. I'd be willing to help anyone who wanted to undertake it. Simon | -----Original Message----- | From: template-haskell-bounces@haskell.org [mailto:template-haskell-bounces@haskell.org] On | Behalf Of Wolfgang Jeltsch | Sent: 09 May 2004 23:14 | To: Template Haskell Mailing List | Subject: [Template-haskell] TH preprocessing | | Hello, | | is there a program which takes a Haskell source file, compiles it with | -ddump-splices, replaces the splices in the source file with the dumped code | and outputs the resulting file? I'd like such a tool since I think it would | it make possible to use TH with Hugs. You would preprocess each file with | this program and feed Hugs with the resulting files. | | Wolfgang | | _______________________________________________ | template-haskell mailing list | template-haskell@haskell.org | http://www.haskell.org/mailman/listinfo/template-haskell
Am Montag, 10. Mai 2004 10:29 schrieben Sie:
Not at present. It's actually a little trickier than it looks, because the post-type-checked program (with the splices expanded) has dictionary stuff floating around, and it's not entirely straightforward to convert it back to vanilla source Haskell.
If I understood TH correctly, the expressions after the "splice operator" $ describe vanilla source Haskell. And I assumed that it's this vanilla source code which -ddump-splices outputs. (I've never checked this myself.) So why isn't it possible to replace the splice parts in the *original* Haskell source file with the outputs of -ddump-splices? This could be done via some search and replace at the text level though this is, of course, not very elegant.
[...]
Wolfgang
On 10/05/2004, at 6:29 PM, Simon Peyton-Jones wrote:
Not at present. It's actually a little trickier than it looks, because the post-type-checked program (with the splices expanded) has dictionary stuff floating around, and it's not entirely straightforward to convert it back to vanilla source Haskell. You're right it would be useful. I think it's feasible with a bit of work. I'd be willing to help anyone who wanted to undertake it.
I wouldn't mind having a look at this. If you could tell me a little about the purpose of the dictionary stuff I'd be willing to have a go at adding this feature. Sean
participants (3)
-
Sean Seefried -
Simon Peyton-Jones -
Wolfgang Jeltsch