# Tuple type

A data type for tuples

## Illustration

We illustrate here the Haskell approach to tuple types.

We can form tuples of different length: pairs, triples, quadruples, ....:

```Prelude> (1,"2")
(1,"2")
Prelude> (1,"2",True)
(1,"2",True)
Prelude> (1,"2",True,42.0)
(1,"2",True,42.0)
```

These tuples are of different tuple types:

```Prelude> (1,"2") :: (Int,String)
(1,"2")
Prelude> (1,"2",True) :: (Int,String,Bool)
(1,"2",True)
Prelude> (1,"2",True,42.0) :: (Int,String,Bool,Float)
(1,"2",True,42.0)
```

We can think of these tuple types as being defined as polymorphic types like this:

```type (a,b) = (a,b)
type (a,b,c) = (a,b,c)
type (a,b,c,d) = (a,b,c,d)
```

Specific tuple types can also be expressed by other means than a designated type constructor for such types. For instance, the illustrative tuple types given above could also be declared like this:

```data TupleType1 = TupleType1 Int String
data TupleType2 = TupleType2 Int String Bool
data TupleType3 = TupleType3 Int String Bool Float
```

(We reuse type names as constructor symbols here, which is possible in Haskell, as these are separate namespaces.) The advantage of the type type constructors (of different arities) is that they capture universally (polymorphically) the notion of ordered tuples, that is, for arbitrary operand types.

this

## User contributions

This user never has never made submissions.

## Syntax for editing wiki

For you are available next options:

will make text bold.

will make text italic.

will make text underlined.

will make text striked.

will allow you to paste code headline into the page.

will allow you to link into the page.

will allow you to paste code with syntax highlight into the page. You will need to define used programming language.

will allow you to paste image into the page.

is list with bullets.

is list with numbers.

will allow your to insert slideshare presentation into the page. You need to copy link to presentation and insert it as parameter in this tag.

will allow your to insert youtube video into the page. You need to copy link to youtube page with video and insert it as parameter in this tag.

will allow your to insert code snippets from @worker.

## Syntax for editing wiki

For you are available next options:

will make text bold.

will make text italic.

will make text underlined.

will make text striked.

will allow you to paste code headline into the page.

will allow you to link into the page.

will allow you to paste code with syntax highlight into the page. You will need to define used programming language.

will allow you to paste image into the page.

is list with bullets.

is list with numbers.

will allow your to insert slideshare presentation into the page. You need to copy link to presentation and insert it as parameter in this tag.

will allow your to insert youtube video into the page. You need to copy link to youtube page with video and insert it as parameter in this tag.

will allow your to insert code snippets from @worker.