#5348: Template Haskell quasiquote escapes
---------------------------------+------------------------------------------
Reporter: simonpj | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.0.3
Keywords: | Testcase:
Blockedby: | Difficulty:
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: None/Unknown
---------------------------------+------------------------------------------
Comment(by YitzGale):
...we might want to say
{{{
[xlang| f x = "abc|]def" |]
}}}
> With my proposal you'd say
{{{
[xlang| f x = "abc\|]def" |]
}}}
With mine you'd say
{{{
[xlang| f x = "abc|\]def" |]
}}}
> With yours you can't say this at all.
I don't understand why you feel {{{"|\]"}}}
is so much worse than {{{"\|]"}}}.
> You may say that you simply have to adjust
> the xlang parser so that X never requires
> you to have the character sequence "|]" in the code.
From the perspective of a user, it is obviously the
case that the usual syntax for xlang will need to be
modified for use within the quasi-quote to avoid {{{"|]"}}}.
The question is whether we force this change upon the
user in a particular way, or whether we leave it up to
the implementer of the quasi-quoter.
> (Notice that we have to avoid the character sequence "|]")
> which seems a little strange.
True. But your proposal at least requires quoting that sequence.
There is no avoiding doing ''something'' to it.
> (Oh, except for backslash itself... that's
> true... Maybe "\\" should not be an escape
> sequence... instead "\\|]" should produce a
> single trailing backslash and close the
> quote. That'd do it.
Not quite. What if you want a literal closing
oxford preceded by one or more backslashes? Shall
the interpretation of the bracket as literal or
closing depend on whether the number of preceding
backslashes is odd or even?
Michael Snoyman once used {{{"|~]"}}} when he
needed literal brackets in a quasi-quoter. It
seems simpler to work out all the cases when the
quoting characters are placed inside the sandwich,
rather than as a topping.
In any case, I still don't understand why we can't
leave as much as possible up to the author of the
quasi-quoter.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5348#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs