[GHC] #7627: Space in nullary unboxed tuples
GHC
cvs-ghc at haskell.org
Tue Feb 12 10:02:08 CET 2013
#7627: Space in nullary unboxed tuples
---------------------------------+------------------------------------------
Reporter: monoidal | Owner:
Type: bug | Status: patch
Priority: normal | Milestone:
Component: Compiler | Version: 7.6.1
Keywords: | Os: Unknown/Multiple
Architecture: Unknown/Multiple | Failure: None/Unknown
Difficulty: Unknown | Testcase:
Blockedby: | Blocking:
Related: |
---------------------------------+------------------------------------------
Changes (by simonpj):
* difficulty: => Unknown
Comment:
I agree that this is a tiresome issue, but I'm not convinced that adding
spaces is the right way to go. What is the name of the type constructor?
Presumably "`(##)`". We don't have ANY type constructors that have spaces
in the middle of their names.
An alternative is to permit "`(##)`" to parse as a type and a term, just
as `()` does. The only reason it does not at the moment is becuase if you
had an operator "`##`", then "`(##)`" would usually be the parenthesised
version of it. The lexer has a special check:
{{{
<0> {
"(#" / { ifExtension unboxedTuplesEnabled `alexAndPred`
notFollowedBySymbol }
{ token IToubxparen }
"#)" / { ifExtension unboxedTuplesEnabled }
{ token ITcubxparen }
}
}}}
Notice that `notFollowedBySymbol` thing. That's what stops "`(##)`"
lexing as "`(#`" followed by "`#)`". I think.
So we could just back off this and say that if you have `-XUboxedTuples`
then "`(##)`" means a unit unboxed tuple, not the operator "`##`". I
think that'd be better.
What about "`(#-)`"? Maybe that should parse as the parenthesised
operator "`#-`". So the lexer would essentialy have to recognise "`(##)`"
and do the right thing (two lexemes).
Simon M, or anyone else, any opinions?
Simon
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7627#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list