Quasi quoting

Henrik Nilsson nhn at Cs.Nott.AC.UK
Mon Feb 1 14:16:38 EST 2010

Hi all,

Simon wrote (answering Robert Greayer):

 > A variant of your suggestion would be: for any quote [|..blah..|]
 > behave as if the programmer had written [quasiQuoter| ...blah...|].
 > That is, simply pick up whatever record named "quasiQuoter" is in
 > scope. Then you'd say
 > 	import Pads( quasiQuoter )
 > and away you go.  But you can only use one at a time.

Yes, I can see that (or one of the alternative forms proposed)
would sometimes be convenient.

But, being explicit about *which* syntax one is switching into
does arguably enhance readability. Without this cue, the reader have to
hunt for the appropriate binding before he or she can make sense
of a piece of quasiquoted text.

Also, as Simon suggests, being explicit makes it possible to use
more than one quasiquoter at a time (in one module). Potentially
quite useful.

I can see being explicit about which quasiquoterbeing to use would
be a bit of an issue in a setting with lots of very small fragments
being spliced in all over the place. But at least in our experience,
and what we've seen in Geoffrey's papers, quiasiquoted code fragments
tend to be relatively substantial, where naming the quasiquoter
doesn't add much overhead at all.



Henrik Nilsson
School of Computer Science
The University of Nottingham
nhn at cs.nott.ac.uk

More information about the Glasgow-haskell-users mailing list