[Haskell-cafe] Showing the 1 element tuple

dgriffi3 at uiuc.edu dgriffi3 at uiuc.edu
Tue Dec 19 17:54:41 EST 2006

On Tue, Dec 19, 2006 at 10:41:56PM +0000, Neil Mitchell wrote:
>A weird question, what does the 1 element tuple look like?
>() -- 0 element tuple
>(,) a b -- 2 element tuple
>(,,) a b c -- 3 element tuple
>() a - meaningless
>(a) - a in brackets
>GHC has the 1 element unboxed tuple, (# a #), and all the other sizes
>unboxed as well, but how would you visually represent the 1 element
>boxed tuple?
>As it happens, Yhc _does_ have the 1 element tuple, you just can't use
>it from normal programs, its only created by desugarings of class
>instances. I'd quite like to change this, and I also need to render
>the 1 element tuple in some way, so wondered if anyone had any good
>ideas (or if there is even some sort of convention)
>I currently use ()1, but don't like that as it doesn't follow Haskell
>rules - the () and 1 would be separate lexemes. My other thought is
>(?), where ? is something appropriate - but all the appropriate things
>I can think of would either not be a lexeme (i.e. 1), having an
>existing meaning (i.e. . | etc) or seem wrong.
Python seems to use (1,) which seems reasonably clear.

Dennis Griffith, ACM at UIUC Treasurer

More information about the Haskell-Cafe mailing list