[commit: ghc] master,ghc-lwc2,type-nats: Change how unboxed tuples are lexed; fixes #7627 (20b98f3)

Ian Lynagh igloo at earth.li
Thu Feb 28 15:20:08 CET 2013


Repository : http://darcs.haskell.org/ghc.git/

On branches: master,ghc-lwc2,type-nats

http://hackage.haskell.org/trac/ghc/changeset/20b98f350d7b30118ca311117903fc039f6b85ce

>---------------------------------------------------------------

commit 20b98f350d7b30118ca311117903fc039f6b85ce
Author: Ian Lynagh <ian at well-typed.com>
Date:   Mon Feb 25 19:02:57 2013 +0000

    Change how unboxed tuples are lexed; fixes #7627
    
    (# is now always a lexeme, even if followed by a symbol.

>---------------------------------------------------------------

 compiler/parser/Lexer.x           | 2 +-
 docs/users_guide/glasgow_exts.xml | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x
index 2746faa..7e801dd 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 c4dd6bb..1357395 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





More information about the ghc-commits mailing list