Haskell Language Construct tuple values


Example

Use parentheses and commas to create tuples. Use one comma to create a pair.

(1, 2)

Use more commas to create tuples with more components.

(1, 2, 3)

(1, 2, 3, 4)

Note that it is also possible to declare tuples using in their unsugared form.

(,) 1 2     -- equivalent to (1,2)
(,,) 1 2 3  -- equivalent to (1,2,3)

Tuples can contain values of different types.

("answer", 42, '?')

Tuples can contain complex values such as lists or more tuples.

([1, 2, 3], "hello", ('A', 65))

(1, (2, (3, 4), 5), 6)