Module

# Data.Tuple.Nested

Package
purescript-tuples
Repository
purescript/purescript-tuples

Utilities for n-tuples: sequences longer than two components built from nested pairs.

Nested tuples arise naturally in product combinators. You shouldn't represent data using nested tuples, but if combinators you're working with create them, utilities in this module will allow to to more easily work with them, including translating to and from more traditional product types.

``````data Address = Address String City (Maybe Province) Country

exampleAddress2 = makeAddressT \$ "221B Baker Street" /\ London /\ Nothing /\ UK

makeAddress :: String -> City -> (Maybe Province) -> Country -> Address

tupleAddress (Address a b c d) = tuple4 a b c d
``````

### #(/\)Source

Operator alias for Data.Tuple.Tuple (right-associative / precedence 6)

Shorthand for constructing n-tuples as nested pairs. `a /\ b /\ c /\ d /\ unit` becomes `Tuple a (Tuple b (Tuple c (Tuple d unit)))`

### #type (/\)Source

Operator alias for Data.Tuple.Tuple (right-associative / precedence 6)

Shorthand for constructing n-tuple types as nested pairs. `forall a b c d. a /\ b /\ c /\ d /\ Unit` becomes `forall a b c d. Tuple a (Tuple b (Tuple c (Tuple d Unit)))`

### #Tuple1Source

``type Tuple1 a = T2 a Unit``

### #Tuple2Source

``type Tuple2 a b = T3 a b Unit``

### #Tuple3Source

``type Tuple3 a b c = T4 a b c Unit``

### #Tuple4Source

``type Tuple4 a b c d = T5 a b c d Unit``

### #Tuple5Source

``type Tuple5 a b c d e = T6 a b c d e Unit``

### #Tuple6Source

``type Tuple6 a b c d e f = T7 a b c d e f Unit``

### #Tuple7Source

``type Tuple7 a b c d e f g = T8 a b c d e f g Unit``

### #Tuple8Source

``type Tuple8 a b c d e f g h = T9 a b c d e f g h Unit``

### #Tuple9Source

``type Tuple9 a b c d e f g h i = T10 a b c d e f g h i Unit``

### #Tuple10Source

``type Tuple10 a b c d e f g h i j = T11 a b c d e f g h i j Unit``

### #T2Source

``type T2 a z = Tuple a z``

### #T3Source

``type T3 a b z = Tuple a (T2 b z)``

### #T4Source

``type T4 a b c z = Tuple a (T3 b c z)``

### #T5Source

``type T5 a b c d z = Tuple a (T4 b c d z)``

### #T6Source

``type T6 a b c d e z = Tuple a (T5 b c d e z)``

### #T7Source

``type T7 a b c d e f z = Tuple a (T6 b c d e f z)``

### #T8Source

``type T8 a b c d e f g z = Tuple a (T7 b c d e f g z)``

### #T9Source

``type T9 a b c d e f g h z = Tuple a (T8 b c d e f g h z)``

### #T10Source

``type T10 a b c d e f g h i z = Tuple a (T9 b c d e f g h i z)``

### #T11Source

``type T11 a b c d e f g h i j z = Tuple a (T10 b c d e f g h i j z)``

### #tuple1Source

``tuple1 :: forall a. a -> Tuple1 a``

Creates a singleton tuple.

### #tuple2Source

``tuple2 :: forall a b. a -> b -> Tuple2 a b``

Given 2 values, creates a 2-tuple.

### #tuple3Source

``tuple3 :: forall a b c. a -> b -> c -> Tuple3 a b c``

Given 3 values, creates a nested 3-tuple.

### #tuple4Source

``tuple4 :: forall a b c d. a -> b -> c -> d -> Tuple4 a b c d``

Given 4 values, creates a nested 4-tuple.

### #tuple5Source

``tuple5 :: forall a b c d e. a -> b -> c -> d -> e -> Tuple5 a b c d e``

Given 5 values, creates a nested 5-tuple.

### #tuple6Source

``tuple6 :: forall a b c d e f. a -> b -> c -> d -> e -> f -> Tuple6 a b c d e f``

Given 6 values, creates a nested 6-tuple.

### #tuple7Source

``tuple7 :: forall a b c d e f g. a -> b -> c -> d -> e -> f -> g -> Tuple7 a b c d e f g``

Given 7 values, creates a nested 7-tuple.

### #tuple8Source

``tuple8 :: forall a b c d e f g h. a -> b -> c -> d -> e -> f -> g -> h -> Tuple8 a b c d e f g h``

Given 8 values, creates a nested 8-tuple.

### #tuple9Source

``tuple9 :: forall a b c d e f g h i. a -> b -> c -> d -> e -> f -> g -> h -> i -> Tuple9 a b c d e f g h i``

Given 9 values, creates a nested 9-tuple.

### #tuple10Source

``tuple10 :: forall a b c d e f g h i j. a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> Tuple10 a b c d e f g h i j``

Given 10 values, creates a nested 10-tuple.

### #get1Source

``get1 :: forall a z. T2 a z -> a``

Given at least a singleton tuple, gets the first value.

### #get2Source

``get2 :: forall a b z. T3 a b z -> b``

Given at least a 2-tuple, gets the second value.

### #get3Source

``get3 :: forall a b c z. T4 a b c z -> c``

Given at least a 3-tuple, gets the third value.

### #get4Source

``get4 :: forall a b c d z. T5 a b c d z -> d``

Given at least a 4-tuple, gets the fourth value.

### #get5Source

``get5 :: forall a b c d e z. T6 a b c d e z -> e``

Given at least a 5-tuple, gets the fifth value.

### #get6Source

``get6 :: forall a b c d e f z. T7 a b c d e f z -> f``

Given at least a 6-tuple, gets the sixth value.

### #get7Source

``get7 :: forall a b c d e f g z. T8 a b c d e f g z -> g``

Given at least a 7-tuple, gets the seventh value.

### #get8Source

``get8 :: forall a b c d e f g h z. T9 a b c d e f g h z -> h``

Given at least an 8-tuple, gets the eigth value.

### #get9Source

``get9 :: forall a b c d e f g h i z. T10 a b c d e f g h i z -> i``

Given at least a 9-tuple, gets the ninth value.

### #get10Source

``get10 :: forall a b c d e f g h i j z. T11 a b c d e f g h i j z -> j``

Given at least a 10-tuple, gets the tenth value.

### #over1Source

``over1 :: forall a r z. (a -> r) -> T2 a z -> T2 r z``

Given at least a singleton tuple, modifies the first value.

### #over2Source

``over2 :: forall a b r z. (b -> r) -> T3 a b z -> T3 a r z``

Given at least a 2-tuple, modifies the second value.

### #over3Source

``over3 :: forall a b c r z. (c -> r) -> T4 a b c z -> T4 a b r z``

Given at least a 3-tuple, modifies the third value.

### #over4Source

``over4 :: forall a b c d r z. (d -> r) -> T5 a b c d z -> T5 a b c r z``

Given at least a 4-tuple, modifies the fourth value.

### #over5Source

``over5 :: forall a b c d e r z. (e -> r) -> T6 a b c d e z -> T6 a b c d r z``

Given at least a 5-tuple, modifies the fifth value.

### #over6Source

``over6 :: forall a b c d e f r z. (f -> r) -> T7 a b c d e f z -> T7 a b c d e r z``

Given at least a 6-tuple, modifies the sixth value.

### #over7Source

``over7 :: forall a b c d e f g r z. (g -> r) -> T8 a b c d e f g z -> T8 a b c d e f r z``

Given at least a 7-tuple, modifies the seventh value.

### #over8Source

``over8 :: forall a b c d e f g h r z. (h -> r) -> T9 a b c d e f g h z -> T9 a b c d e f g r z``

Given at least an 8-tuple, modifies the eighth value.

### #over9Source

``over9 :: forall a b c d e f g h i r z. (i -> r) -> T10 a b c d e f g h i z -> T10 a b c d e f g h r z``

Given at least a 9-tuple, modifies the ninth value.

### #over10Source

``over10 :: forall a b c d e f g h i j r z. (j -> r) -> T11 a b c d e f g h i j z -> T11 a b c d e f g h i r z``

Given at least a 10-tuple, modifies the tenth value.

### #uncurry1Source

``uncurry1 :: forall a r z. (a -> r) -> T2 a z -> r``

Given a function of 1 argument, returns a function that accepts a singleton tuple.

### #uncurry2Source

``uncurry2 :: forall a b r z. (a -> b -> r) -> T3 a b z -> r``

Given a function of 2 arguments, returns a function that accepts a 2-tuple.

### #uncurry3Source

``uncurry3 :: forall a b c r z. (a -> b -> c -> r) -> T4 a b c z -> r``

Given a function of 3 arguments, returns a function that accepts a 3-tuple.

### #uncurry4Source

``uncurry4 :: forall a b c d r z. (a -> b -> c -> d -> r) -> T5 a b c d z -> r``

Given a function of 4 arguments, returns a function that accepts a 4-tuple.

### #uncurry5Source

``uncurry5 :: forall a b c d e r z. (a -> b -> c -> d -> e -> r) -> T6 a b c d e z -> r``

Given a function of 5 arguments, returns a function that accepts a 5-tuple.

### #uncurry6Source

``uncurry6 :: forall a b c d e f r z. (a -> b -> c -> d -> e -> f -> r) -> T7 a b c d e f z -> r``

Given a function of 6 arguments, returns a function that accepts a 6-tuple.

### #uncurry7Source

``uncurry7 :: forall a b c d e f g r z. (a -> b -> c -> d -> e -> f -> g -> r) -> T8 a b c d e f g z -> r``

Given a function of 7 arguments, returns a function that accepts a 7-tuple.

### #uncurry8Source

``uncurry8 :: forall a b c d e f g h r z. (a -> b -> c -> d -> e -> f -> g -> h -> r) -> T9 a b c d e f g h z -> r``

Given a function of 8 arguments, returns a function that accepts an 8-tuple.

### #uncurry9Source

``uncurry9 :: forall a b c d e f g h i r z. (a -> b -> c -> d -> e -> f -> g -> h -> i -> r) -> T10 a b c d e f g h i z -> r``

Given a function of 9 arguments, returns a function that accepts a 9-tuple.

### #uncurry10Source

``uncurry10 :: forall a b c d e f g h i j r z. (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> r) -> T11 a b c d e f g h i j z -> r``

Given a function of 10 arguments, returns a function that accepts a 10-tuple.

### #curry1Source

``curry1 :: forall a r z. z -> (T2 a z -> r) -> a -> r``

Given a function that accepts at least a singleton tuple, returns a function of 1 argument.

### #curry2Source

``curry2 :: forall a b r z. z -> (T3 a b z -> r) -> a -> b -> r``

Given a function that accepts at least a 2-tuple, returns a function of 2 arguments.

### #curry3Source

``curry3 :: forall a b c r z. z -> (T4 a b c z -> r) -> a -> b -> c -> r``

Given a function that accepts at least a 3-tuple, returns a function of 3 arguments.

### #curry4Source

``curry4 :: forall a b c d r z. z -> (T5 a b c d z -> r) -> a -> b -> c -> d -> r``

Given a function that accepts at least a 4-tuple, returns a function of 4 arguments.

### #curry5Source

``curry5 :: forall a b c d e r z. z -> (T6 a b c d e z -> r) -> a -> b -> c -> d -> e -> r``

Given a function that accepts at least a 5-tuple, returns a function of 5 arguments.

### #curry6Source

``curry6 :: forall a b c d e f r z. z -> (T7 a b c d e f z -> r) -> a -> b -> c -> d -> e -> f -> r``

Given a function that accepts at least a 6-tuple, returns a function of 6 arguments.

### #curry7Source

``curry7 :: forall a b c d e f g r z. z -> (T8 a b c d e f g z -> r) -> a -> b -> c -> d -> e -> f -> g -> r``

Given a function that accepts at least a 7-tuple, returns a function of 7 arguments.

### #curry8Source

``curry8 :: forall a b c d e f g h r z. z -> (T9 a b c d e f g h z -> r) -> a -> b -> c -> d -> e -> f -> g -> h -> r``

Given a function that accepts at least an 8-tuple, returns a function of 8 arguments.

### #curry9Source

``curry9 :: forall a b c d e f g h i r z. z -> (T10 a b c d e f g h i z -> r) -> a -> b -> c -> d -> e -> f -> g -> h -> i -> r``

Given a function that accepts at least a 9-tuple, returns a function of 9 arguments.

### #curry10Source

``curry10 :: forall a b c d e f g h i j r z. z -> (T11 a b c d e f g h i j z -> r) -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> r``

Given a function that accepts at least a 10-tuple, returns a function of 10 arguments.