Tuple

object Tuple
Companion:
class
Source:
Tuple.scala
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Tuple.type

Type members

Types

type Concat[X <: Tuple, +Y <: Tuple] = X match { case EmptyTuple => Y case x1 *: xs1 => x1 *: Concat[xs1, Y] }

Type of the concatenation of two tuples

Type of the concatenation of two tuples

Source:
Tuple.scala
type Drop[T <: Tuple, N <: Int] = N match { case 0 => T case S[n1] => T match { case EmptyTuple => EmptyTuple case x *: xs => Drop[xs, n1] } }

Transforms a tuple (T1, ..., Tn) into (Ti+1, ..., Tn).

Transforms a tuple (T1, ..., Tn) into (Ti+1, ..., Tn).

Source:
Tuple.scala
type Elem[X <: Tuple, N <: Int] = X match { case x *: xs => N match { case 0 => x case S[n1] => Elem[xs, n1] } }

Type of the element at position N in the tuple X

Type of the element at position N in the tuple X

Source:
Tuple.scala
type Filter[Tup <: Tuple, P <: ([_] =>> Boolean)] = Tup match { case EmptyTuple => EmptyTuple case h *: t => P[h] match { case true => h *: Filter[t, P] case false => Filter[t, P] } }

Filters out those members of the tuple for which the predicate P returns false. A predicate P[X] is a type that can be either true or false. For example:

Filters out those members of the tuple for which the predicate P returns false. A predicate P[X] is a type that can be either true or false. For example:

type IsString[x] = x match {
  case String => true
  case _ => false
}
Filter[(1, "foo", 2, "bar"), IsString] =:= ("foo", "bar")
Source:
Tuple.scala
type FlatMap[Tup <: Tuple, F <: ([_ <: Union[Tup]] =>> Tuple)] = Tup match { case EmptyTuple => EmptyTuple case h *: t => Concat[F[h], FlatMap[t, F]] }

Converts a tuple (T1, ..., Tn) to a flattened (..F[T1], ..., ..F[Tn])

Converts a tuple (T1, ..., Tn) to a flattened (..F[T1], ..., ..F[Tn])

Source:
Tuple.scala
type Fold[Tup <: Tuple, Z, F[_, _]] = Tup match { case EmptyTuple => Z case h *: t => F[h, Fold[t, Z, F]] }

Fold a tuple (T1, ..., Tn) into F[T1, F[... F[Tn, Z]...]]]

Fold a tuple (T1, ..., Tn) into F[T1, F[... F[Tn, Z]...]]]

Source:
Tuple.scala
type Head[X <: NonEmptyTuple] = X match { case x *: _$14 => x }

Type of the head of a tuple

Type of the head of a tuple

Source:
Tuple.scala
type InverseMap[X <: Tuple, F[_]] = X match { case F[x] *: t => x *: InverseMap[t, F] case EmptyTuple => EmptyTuple }

Converts a tuple (F[T1], ..., F[Tn]) to (T1, ... Tn)

Converts a tuple (F[T1], ..., F[Tn]) to (T1, ... Tn)

Source:
Tuple.scala
type IsMappedBy[F[_]] = [X <: Tuple] =>> X =:= Map[InverseMap[X, F], F]

Implicit evidence.

Implicit evidence. IsMappedBy[F][X] is present in the implicit scope iff X is a tuple for which each element's type is constructed via F. E.g. (F[A1], ..., F[An]), but not (F[A1], B2, ..., F[An]) where B2 does not have the shape of F[A].

Source:
Tuple.scala
type Map[Tup <: Tuple, F[_ <: Union[Tup]]] = Tup match { case EmptyTuple => EmptyTuple case h *: t => F[h] *: Map[t, F] }

Converts a tuple (T1, ..., Tn) to (F[T1], ..., F[Tn])

Converts a tuple (T1, ..., Tn) to (F[T1], ..., F[Tn])

Source:
Tuple.scala
type Size[X <: Tuple] = X match { case EmptyTuple => 0 case x *: xs => S[Size[xs]] }

Literal constant Int size of a tuple

Literal constant Int size of a tuple

Source:
Tuple.scala
type Split[T <: Tuple, N <: Int] = (Take[T, N], Drop[T, N])

Splits a tuple (T1, ..., Tn) into a pair of two tuples (T1, ..., Ti) and (Ti+1, ..., Tn).

Splits a tuple (T1, ..., Tn) into a pair of two tuples (T1, ..., Ti) and (Ti+1, ..., Tn).

Source:
Tuple.scala
type Tail[X <: NonEmptyTuple] = X match { case _$15 *: xs => xs }

Type of the tail of a tuple

Type of the tail of a tuple

Source:
Tuple.scala
type Take[T <: Tuple, N <: Int] = N match { case 0 => EmptyTuple case S[n1] => T match { case EmptyTuple => EmptyTuple case x *: xs => x *: Take[xs, n1] } }

Transforms a tuple (T1, ..., Tn) into (T1, ..., Ti).

Transforms a tuple (T1, ..., Tn) into (T1, ..., Ti).

Source:
Tuple.scala
type Union[T <: Tuple] = Fold[T, Nothing, [x, y] =>> x | y]

Given a tuple (T1, ..., Tn), returns a union of its member types: T1 | ... | Tn.

Given a tuple (T1, ..., Tn), returns a union of its member types: T1 | ... | Tn. Returns Nothing if the tuple is empty.

Source:
Tuple.scala
type Zip[T1 <: Tuple, T2 <: Tuple] = (T1, T2) match { case (h1 *: t1, h2 *: t2) => (h1, h2) *: Zip[t1, t2] case (EmptyTuple, _$11) => EmptyTuple case (_$12, EmptyTuple) => EmptyTuple case _$13 => Tuple }

Given two tuples, A1 *: ... *: An * At and B1 *: ... *: Bn *: Bt where at least one of At or Bt is EmptyTuple or Tuple, returns the tuple type (A1, B1) *: ... *: (An, Bn) *: Ct where Ct is EmptyTuple if At or Bt is EmptyTuple, otherwise Ct is Tuple.

Given two tuples, A1 *: ... *: An * At and B1 *: ... *: Bn *: Bt where at least one of At or Bt is EmptyTuple or Tuple, returns the tuple type (A1, B1) *: ... *: (An, Bn) *: Ct where Ct is EmptyTuple if At or Bt is EmptyTuple, otherwise Ct is Tuple.

Source:
Tuple.scala

Inherited types

The names of the product elements

The names of the product elements

Inherited from:
Mirror
Source:
Mirror.scala

The name of the type

The name of the type

Inherited from:
Mirror
Source:
Mirror.scala

Value members

Concrete methods

Empty tuple

Empty tuple

Source:
Tuple.scala
def apply[T](x: T): T *: EmptyTuple

Tuple with one element

Tuple with one element

Source:
Tuple.scala
def fromArray[T](xs: Array[T]): Tuple

Convert an array into a tuple of unknown arity and types

Convert an array into a tuple of unknown arity and types

Source:
Tuple.scala
def fromIArray[T](xs: IArray[T]): Tuple

Convert an immutable array into a tuple of unknown arity and types

Convert an immutable array into a tuple of unknown arity and types

Source:
Tuple.scala
def fromProduct(product: Product): Tuple

Convert a Product into a tuple of unknown arity and types

Convert a Product into a tuple of unknown arity and types

Source:
Tuple.scala
def fromProductTyped[P <: Product](p: P)(using m: ProductOf[P]): <none>
def unapply(x: EmptyTuple): true

Matches an empty tuple.

Matches an empty tuple.

Source:
Tuple.scala

Givens

Givens

given canEqualTuple[H1, T1 <: Tuple, H2, T2 <: Tuple](using eqHead: CanEqual[H1, H2], eqTail: CanEqual[T1, T2]): CanEqual[H1 *: T1, H2 *: T2]