summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2013-02-25 19:02:57 +0000
committerIan Lynagh <ian@well-typed.com>2013-02-25 21:42:42 +0000
commit20b98f350d7b30118ca311117903fc039f6b85ce (patch)
tree2262ab4eb1ada0d32953ed4a24e49bfbdbe95122
parent890f4657e0edc9fa945c1e70ddf1bec1f52b7590 (diff)
downloadhaskell-20b98f350d7b30118ca311117903fc039f6b85ce.tar.gz
Change how unboxed tuples are lexed; fixes #7627
(# is now always a lexeme, even if followed by a symbol.
-rw-r--r--compiler/parser/Lexer.x2
-rw-r--r--docs/users_guide/glasgow_exts.xml8
2 files changed, 9 insertions, 1 deletions
diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x
index 2746faa34e..7e801dde21 100644
--- a/compiler/parser/Lexer.x
+++ b/compiler/parser/Lexer.x
@@ -339,7 +339,7 @@ $tab+ { warn Opt_WarnTabs (text "Tab character") }
}
<0> {
- "(#" / { ifExtension unboxedTuplesEnabled `alexAndPred` notFollowedBySymbol }
+ "(#" / { ifExtension unboxedTuplesEnabled }
{ token IToubxparen }
"#)" / { ifExtension unboxedTuplesEnabled }
{ token ITcubxparen }
diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml
index c4dd6bbf5e..1357395eff 100644
--- a/docs/users_guide/glasgow_exts.xml
+++ b/docs/users_guide/glasgow_exts.xml
@@ -225,6 +225,14 @@ the same.
</para>
<para>
+Note that when unboxed tuples are enabled,
+<literal>(#</literal> is a single lexeme, so for example when using
+operators like <literal>#</literal> and <literal>#-</literal> you need
+to write <literal>( # )</literal> and <literal>( #- )</literal> rather than
+<literal>(#)</literal> and <literal>(#-)</literal>.
+</para>
+
+<para>
Unboxed tuples are used for functions that need to return multiple
values, but they avoid the heap allocation normally associated with
using fully-fledged tuples. When an unboxed tuple is returned, the