RE: QuasiQuoting for declarations

Simon Peyton-Jones <[email protected]> Mon, 1 Dec 2008 15:09:18 +0000
Newsgroups gmane.comp.lang.haskell.template
Message-ID <638ABD0A29C8884A91BC5FB5C349B1C332817C4530@EA-EXMSG-C334.europe.corp.microsoft.com>
--===============1800352690==
Content-Language: en-US
Content-Type: multipart/alternative;
	boundary="_000_638ABD0A29C8884A91BC5FB5C349B1C332817C4530EAEXMSGC334eu_"

--_000_638ABD0A29C8884A91BC5FB5C349B1C332817C4530EAEXMSGC334eu_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

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.SpliceDe=
cl.  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 u=
p, 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 abo=
ut applications: what are you using it for?

Simon

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

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

--_000_638ABD0A29C8884A91BC5FB5C349B1C332817C4530EAEXMSGC334eu_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:=
//www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; charset=3Dus-ascii"=
>
<meta name=3DGenerator content=3D"Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Tahoma;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-reply;
	font-family:"Calibri","sans-serif";
	color:#1F497D;}
.MsoChpDefault
	{mso-style-type:export-only;}
@page Section1
	{size:612.0pt 792.0pt;
	margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
	{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext=3D"edit">
  <o:idmap v:ext=3D"edit" data=3D"1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=3DEN-GB link=3Dblue vlink=3Dpurple>

<div class=3DSection1>

<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'>I think there is no difficulty in principle.<o:p></o:p></spa=
n></p>

<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'>In the HsExpr you&#8217;ll see the constructors<o:p></o:p></=
span></p>

<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HsSpliceE<o:p></o:p></span></p>

<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HsQuasiQuoteE<o:p></o:p></span></p>

<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'>The former is run by the type checker; thelatter by the rena=
mer.<o:p></o:p></span></p>

<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'>To fulfil your hope, we&#8217;d need to add a new constructo=
r to HsDecls.SpliceDecl.&nbsp;
At the moment it just has<o:p></o:p></span></p>

<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SpliceDecl<o:p></o:p></span></p>

<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'>and we&#8217;d add<o:p></o:p></span></p>

<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; QuasiQuoteDecl<o:p></o:p></span></p>

<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'>After that I think the rest would follow. If someone feels l=
ike
taking it up, I&#8217;d be glad to help.&nbsp; For a start, make a Trac fea=
ture request
and dump this thread into it.<o:p></o:p></span></p>

<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'>Meanwhile, I gather you are using quasi-quotes.&nbsp; I&#821=
7;m interested
to know about applications: what are you using it for?<o:p></o:p></span></p=
>

<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'><br>
Simon<o:p></o:p></span></p>

<p class=3DMsoNormal><span style=3D'font-size:11.0pt;font-family:"Calibri",=
"sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div style=3D'border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm =
4.0pt'>

<div>

<div style=3D'border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm =
0cm 0cm'>

<p class=3DMsoNormal><b><span lang=3DEN-US style=3D'font-size:10.0pt;font-f=
amily:
"Tahoma","sans-serif"'>From:</span></b><span lang=3DEN-US style=3D'font-siz=
e:10.0pt;
font-family:"Tahoma","sans-serif"'> [email protected]
[mailto:[email protected]] <b>On Behalf Of </b>Andrea
Vezzosi<br>
<b>Sent:</b> 01 December 2008 08:15<br>
<b>To:</b> [email protected]<br>
<b>Subject:</b> [Template-haskell] QuasiQuoting for declarations<o:p></o:p>=
</span></p>

</div>

</div>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal>Currently quasiquoting is limited to patterns and
expressions, are there any problems in extending it to declarations? we alr=
eady
have [d| ... |] and toplevel splices afterall.<o:p></o:p></p>

</div>

</div>

</body>

</html>

--_000_638ABD0A29C8884A91BC5FB5C349B1C332817C4530EAEXMSGC334eu_--

--===============1800352690==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
template-haskell mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/template-haskell

--===============1800352690==--