# Tuples

**Tuples**, unlike lists, can contain elements of **different types**. The elements of a tuple are enclosed in round parentheses and separated by commas:

```haskell
("Cardano", True) :: (String, Bool)
```

The above is an example of a **tuple pair** that is comprised of two elements, in this case, a string and a boolean. Notice that the tuple type is dependent on its elements – both the number of elements and their individual types. Unlike with lists, where we have one clear type for any single list regardless of its length, tuples must be finite and the type of each element must be known in order for the Haskell type system to able to work properly. The length of a tuple is sometimes referred to as its **arity**.

```haskell
[1] :: [Int] -- The type of the list is the same...
[1, 2, 3] :: [Int] -- ...regardless of its length.

(1, 2) :: (Int, Int) -- The type of the tuple changes...
(1, 2, False) :: (Int, Int, Bool) -- ...with its length (and element types).
```

**Tuples** are most commonly used as key-value pairs – a data structure for storing and retrieving data. That is why I said **pairs** are the most common of tuples – for example, a name–address pair or a dictionary word-definition pair.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://haskell.hpmeducation.com/types-in-haskell/data-structure-types/tuples.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
