[Haskell-cafe] Another Quasi-Quotation question

jean-christophe mincke jeanchristophe.mincke at gmail.com
Wed Nov 24 03:14:34 EST 2010


Hello,

I am still playing with template-haskell...

I wonder, is there any reason why a quasiquoter cannot create haskell
statements and declarations in addition to expressions and patterns? Or more
generally create any legal Haskell syntax tree.

I.e Suppose I would like to create a quasiquoter for the C language (please,
imagine that it could be useful).

I could write sth such as :

[$c|

int a = 6;
int b = 7;
int c = a +b;

struct S { int x; int y}
|]

It could be nice to generate the appropriate haskell code:

a = 6
b= 7
c= a + b
data S = S {  x::Int; y:Int}
etc

That would allow to really embed any kind of language in a more or less easy
way into haskell, provided that code can be translated into legal haskell.

Is there anything that prevent these features.

Thank you

Regards

J-C
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20101124/d152ef86/attachment.html


More information about the Haskell-Cafe mailing list