Commit 20b98f35 authored by ian@well-typed.com's avatar ian@well-typed.com

Change how unboxed tuples are lexed; fixes #7627

(# is now always a lexeme, even if followed by a symbol.
parent 890f4657
...@@ -339,7 +339,7 @@ $tab+ { warn Opt_WarnTabs (text "Tab character") } ...@@ -339,7 +339,7 @@ $tab+ { warn Opt_WarnTabs (text "Tab character") }
} }
<0> { <0> {
"(#" / { ifExtension unboxedTuplesEnabled `alexAndPred` notFollowedBySymbol } "(#" / { ifExtension unboxedTuplesEnabled }
{ token IToubxparen } { token IToubxparen }
"#)" / { ifExtension unboxedTuplesEnabled } "#)" / { ifExtension unboxedTuplesEnabled }
{ token ITcubxparen } { token ITcubxparen }
......
...@@ -224,6 +224,14 @@ type (primitive or non-primitive). The type of an unboxed tuple looks ...@@ -224,6 +224,14 @@ type (primitive or non-primitive). The type of an unboxed tuple looks
the same. the same.
</para> </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> <para>
Unboxed tuples are used for functions that need to return multiple Unboxed tuples are used for functions that need to return multiple
values, but they avoid the heap allocation normally associated with values, but they avoid the heap allocation normally associated with
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment