
12 Jun
2010
12 Jun
'10
8:23 p.m.
On Saturday 12 June 2010 22:09:48, bitur mail wrote:
Hello,
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 True That's different to e.g. Python:
x = (3,) len(x) 1 type(x)
x == 3 False
which has a notion of 1-tuples having a type different from the type of their components.
Thanks :) DG