[Haskell] ANNOUNCE: string-qq-0.0.2

Yitzchak Gale gale at sefer.org
Wed Jun 29 14:37:42 CEST 2011


Steffen Schuldenzucker wrote:
> Btw., does TH parse this correctly? (If I was TH, I would not):
>
>> myPHPCode = [s|
>> <?php
>> $description = "Use the quasiquoter like this: [s|some text|]";
>> print $description."\n";
>> ?>
>> |]
>
> (the tricky part is "|]" occurring in the quoted text)
>
> Can we escape it?

Yes, like this:

myPHPCode = [s|
<?php
$description = "Use the quasiquoter like this: [s|some text|]++"|]"++[s|";
print $description."\n";
?>
|]

It's a good thing I'm not the one who wrote this
quasiquoter. I would have built in a special exception
that rejects any string containing "<?php".

Regards,
Yitz



More information about the Haskell mailing list