# Data.Tuple

- Package
- purescript-tuples
- Repository
- purescript/purescript-tuples

A data type and functions for working with ordered pairs.

### #Tuple Source

`data Tuple a b`

A simple product type for wrapping a pair of component values.

#### Constructors

`Tuple a b`

#### Instances

`(Show a, Show b) => Show (Tuple a b)`

`(Eq a, Eq b) => Eq (Tuple a b)`

Allows

`Tuple`

s to be checked for equality with`==`

and`/=`

whenever there are`Eq`

instances for both component types.`(Eq a) => Eq1 (Tuple a)`

`(Ord a, Ord b) => Ord (Tuple a b)`

Allows

`Tuple`

s to be compared with`compare`

,`>`

,`>=`

,`<`

and`<=`

whenever there are`Ord`

instances for both component types. To obtain the result, the`fst`

s are`compare`

d, and if they are`EQ`

ual, the`snd`

s are`compare`

d.`(Ord a) => Ord1 (Tuple a)`

`(Bounded a, Bounded b) => Bounded (Tuple a b)`

`Semigroupoid Tuple`

`(Semigroup a, Semigroup b) => Semigroup (Tuple a b)`

The

`Semigroup`

instance enables use of the associative operator`<>`

on`Tuple`

s whenever there are`Semigroup`

instances for the component types. The`<>`

operator is applied pairwise, so:`(Tuple a1 b1) <> (Tuple a2 b2) = Tuple (a1 <> a2) (b1 <> b2)`

`(Monoid a, Monoid b) => Monoid (Tuple a b)`

`(Semiring a, Semiring b) => Semiring (Tuple a b)`

`(Ring a, Ring b) => Ring (Tuple a b)`

`(CommutativeRing a, CommutativeRing b) => CommutativeRing (Tuple a b)`

`(HeytingAlgebra a, HeytingAlgebra b) => HeytingAlgebra (Tuple a b)`

`(BooleanAlgebra a, BooleanAlgebra b) => BooleanAlgebra (Tuple a b)`

`Functor (Tuple a)`

The

`Functor`

instance allows functions to transform the contents of a`Tuple`

with the`<$>`

operator, applying the function to the second component, so:`f <$> (Tuple x y) = Tuple x (f y)`

`Invariant (Tuple a)`

`Bifunctor Tuple`

`(Semigroup a) => Apply (Tuple a)`

The

`Functor`

instance allows functions to transform the contents of a`Tuple`

with the`<*>`

operator whenever there is a`Semigroup`

instance for the`fst`

component, so:`(Tuple a1 f) <*> (Tuple a2 x) == Tuple (a1 <> a2) (f x)`

`Biapply Tuple`

`(Monoid a) => Applicative (Tuple a)`

`Biapplicative Tuple`

`(Semigroup a) => Bind (Tuple a)`

`(Monoid a) => Monad (Tuple a)`

`Extend (Tuple a)`

`Comonad (Tuple a)`

`(Lazy a, Lazy b) => Lazy (Tuple a b)`

`Foldable (Tuple a)`

`Bifoldable Tuple`

`Traversable (Tuple a)`

`Bitraversable Tuple`

`(TypeEquals a Unit) => Distributive (Tuple a)`

- Modules
- Data.
Tuple - Data.
Tuple. Nested

Allows

`Tuple`

s to be rendered as a string with`show`

whenever there are`Show`

instances for both component types.