summaryrefslogtreecommitdiff
path: root/docs/users_guide
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2016-03-11 10:38:42 +0100
committerBen Gamari <ben@smart-cactus.org>2016-03-11 13:20:17 +0100
commit767ff7cab7fc2d27b66cdd25d551ccf9e9e7c51d (patch)
treeadd5136a1b957c92443beecb47c6a9e8c2500175 /docs/users_guide
parentf3def7643d390db54d18b8c3d385c490fba58a41 (diff)
downloadhaskell-767ff7cab7fc2d27b66cdd25d551ccf9e9e7c51d.tar.gz
Document Quasi-quotes/list comprehension ambiguity
Test Plan: read it Reviewers: austin, goldfire Reviewed By: goldfire Subscribers: hvr, thomie Differential Revision: https://phabricator.haskell.org/D1981 GHC Trac Issues: #11679
Diffstat (limited to 'docs/users_guide')
-rw-r--r--docs/users_guide/glasgow_exts.rst28
1 files changed, 27 insertions, 1 deletions
diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst
index 454c73e737..dd714ece35 100644
--- a/docs/users_guide/glasgow_exts.rst
+++ b/docs/users_guide/glasgow_exts.rst
@@ -1873,7 +1873,15 @@ The following syntax is stolen:
Stolen by: :ghc-flag:`-XImplicitParams`
-``[|``, ``[e|``, ``[p|``, ``[d|``, ``[t|``, ``$(``, ``$$(``, ``[||``, ``[e||``, ``$varid``, ``$$varid``
+``[|``, ``[e|``, ``[p|``, ``[d|``, ``[t|``, ``[||``, ``[e||``
+ .. index::
+ single: Quasi-quotes
+
+ Stolen by: :ghc-flag:`-XQuasiQuotes`. Moreover, this introduces an ambiguity
+ with list comprehension syntax. See
+ :ref:`quasi-quotes-list-comprehension-ambiguity` for details.
+
+``$(``, ``$$(``, ``$varid``, ``$$varid``
.. index::
single: Template Haskell
@@ -9985,6 +9993,24 @@ Here are the salient features
quasi-quotes do not cause a declaration group break. See
:ref:`th-syntax` for more information.
+.. _quasi-quotes-list-comprehension-ambiguity:
+
+.. warning::
+
+ .. index::
+ single: quasi-quotes; ambiguity with list comprehensions
+ single: list comprehensions; ambiguity with quasi-quotes
+
+ :ghc-flag:`-XQuasiQuotes` introduces an unfortunate ambiguity with list
+ comprehension syntax. Consider the following, ::
+
+ let x = [v| v <- [0..10]]
+
+ Without :ghc-flag:`-XQuasiQuotes` this is parsed as a list comprehension.
+ With :ghc-flag:`-XQuasiQuotes` this is parsed as a quasi-quote; however,
+ this parse will fail due to the lack of a closing ``|]``. See
+ :ghc-ticket:`11679`.
+
The example below shows quasi-quotation in action. The quoter ``expr``
is bound to a value of type ``QuasiQuoter`` defined in module ``Expr``.
The example makes use of an antiquoted variable ``n``, indicated by the