
Nan, generally speaking (e.g., in maths) tuples can contain any number of
elements. Haskell specifically disallows one-tuples because of the
ambiguity in parsing them. Instead, (expr) is just evaluated as expr. On
the other hand, it does allow (), which is a zero-tuple. Haskell's
compilers also impose an upper bound on the practical size of a tuple (for
modern GHC, that's 61, as Max mentioned) but that isn't a restriction of
the Haskell language itself. If you want, you can consider Identity a to be
a one-tuple, but it obviously doesn't use tuple syntax.
As a side note, a 1-tuple is occasionally called a monad in other
disciplines, while a monad is actually defined as a triple (a three-tuple)
in maths. None of that is relevant to Haskell though.
On Thu, Feb 25, 2016 at 7:14 AM Max Voit
On Thu, 25 Feb 2016 07:49:56 +0800 Nan Xiao
wrote: Rein referred "A tuple can have any number of elements", while Graham referred "There's no "one-ple", or 1-tuple, in Haskell.". So which one is right? The tuple at least contains 2 elements?
There is no one-tuple; however, there's a zero-tuple. Also no arbitrary number of tuple elements allowed, due to definition (we're at 61 for some reason). Refer to
http://hackage.haskell.org/package/ghc-prim-0.4.0.0/docs/GHC-Tuple.html
best, Max _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners