Tuple

scala.Tuple$
See theTuple companion trait
object Tuple

Attributes

Companion
trait
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Tuple.type

Members list

Type members

Types

type Append[X <: Tuple, Y] = X match { case EmptyTuple => Y *: EmptyTuple case x *: xs => x *: Append[xs, Y] }

Type of a tuple with an element appended

Type of a tuple with an element appended

Attributes

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

Attributes

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).

Attributes

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

Attributes

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] <: Boolean = x match {
  case String => true
  case _ => false
}
summon[Tuple.Filter[(1, "foo", 2, "bar"), IsString] =:= ("foo", "bar")]

Attributes

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])

Attributes

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]...]]]

Attributes

type Head[X <: NonEmptyTuple] = X match { case x *: _$13 => x }

Type of the head of a tuple

Type of the head of a tuple

Attributes

type Init[X <: Tuple] = X match { case _$14 *: EmptyTuple => EmptyTuple case x *: xs => x *: Init[xs] }

Type of the initial part of the tuple without its last element

Type of the initial part of the tuple without its last element

Attributes

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)

Attributes

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

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].

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].

Attributes

type Last[X <: Tuple] = X match { case x *: EmptyTuple => x case _$16 *: xs => Last[xs] }

Type of the last element of a tuple

Type of the last element of a tuple

Attributes

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])

Attributes

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

Attributes

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).

Attributes

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

Type of the tail of a tuple

Type of the tail of a tuple

Attributes

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).

Attributes

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. Returns Nothing if the tuple is empty.

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

Attributes

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 Any => 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.

Attributes

Value members

Concrete methods

def apply(): EmptyTuple

Empty tuple

Empty tuple

Attributes

def apply[T](x: T): T *: EmptyTuple

Tuple with one element

Tuple with one element

Attributes

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

Attributes

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

Attributes

Convert a Product into a tuple of unknown arity and types

Convert a Product into a tuple of unknown arity and types

Attributes

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

Matches an empty tuple.

Matches an empty tuple.

Attributes

Givens

Givens

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