I think there is no difficulty in principle.

 

In the HsExpr you’ll see the constructors

                HsSpliceE

                HsQuasiQuoteE

The former is run by the type checker; thelatter by the renamer.

 

To fulfil your hope, we’d need to add a new constructor to HsDecls.SpliceDecl.  At the moment it just has

                SpliceDecl

and we’d add

                QuasiQuoteDecl

 

After that I think the rest would follow. If someone feels like taking it up, I’d be glad to help.  For a start, make a Trac feature request and dump this thread into it.

 

Meanwhile, I gather you are using quasi-quotes.  I’m interested to know about applications: what are you using it for?


Simon

 

From: template-haskell-bounces@haskell.org [mailto:template-haskell-bounces@haskell.org] On Behalf Of Andrea Vezzosi
Sent: 01 December 2008 08:15
To: template-haskell@haskell.org
Subject: [Template-haskell] QuasiQuoting for declarations

 

Currently quasiquoting is limited to patterns and expressions, are there any problems in extending it to declarations? we already have [d| ... |] and toplevel splices afterall.