[Haskell-cafe] Showing the 1 element tuple

Neil Mitchell ndmitchell at gmail.com
Tue Dec 19 17:41:56 EST 2006


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.



More information about the Haskell-Cafe mailing list