[Haskell-beginners] one element tuple
daniel.is.fischer at web.de
Sat Jun 12 16:23:24 EDT 2010
On Saturday 12 June 2010 22:09:48, bitur mail wrote:
> This is a dumb question but ...
> I'm just starting with the book Real World Haskell, and in chapter 2 it
> mentions that "Haskell doesn't have a notion of a one-element tuple".
> I am confused by this because I type, for example, (143), into the
> interpreter and it does not complain. What does Haskell consider (143)
> to be?
An ordinary value, enclosed in parentheses.
Prelude> :t (143)
(143) :: (Num t) => t
Prelude> (143) == 143
That's different to e.g. Python:
>>> x = (3,)
>>> x == 3
which has a notion of 1-tuples having a type different from the type of
> Thanks :)
More information about the Beginners