Tuple

scala.Tuple
See theTuple companion trait
object Tuple

Attributes

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

Members list

Type members

Types

infix type ++[X <: Tuple, +Y <: Tuple] = Concat[X, Y]

An infix shorthand for Concat[X, Y]

An infix shorthand for Concat[X, Y]

Attributes

infix type :*[X <: Tuple, Y] = Append[X, Y]

An infix shorthand for Append[X, Y]

An infix shorthand for Append[X, Y]

Attributes

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 Contains[X <: Tuple, Y] = X match { case Y *: _$13 => true case _$14 *: xs => Contains[xs, Y] case EmptyTuple => false }

A type level Boolean indicating whether the tuple X has an element that matches Y.

A type level Boolean indicating whether the tuple X has an element that matches Y.

Attributes

type Disjoint[X <: Tuple, Y <: Tuple] = X match { case x *: xs => Contains[Y, x] match { case true => false case false => Disjoint[xs, Y] } case EmptyTuple => true }

A type level Boolean indicating whether the type Y contains none of the elements of X.

A type level Boolean indicating whether the type Y contains none of the elements of X.

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 <: ([_ <: Union[Tup]] =>> 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 <: Tuple] = X match { case x *: _$15 => x }

Type of the head of a tuple

Type of the head of a tuple

Attributes

type Init[X <: Tuple] = X match { case _$11 *: 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 _$12 *: 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 of the reversed tuple

Type of the reversed tuple

Attributes

type ReverseOnto[From <: Tuple, +To <: Tuple] = From match { case x *: xs => ReverseOnto[xs, x *: To] case EmptyTuple => To }

Prepends all elements of a tuple in reverse order onto the other tuple

Prepends all elements of a tuple in reverse order onto the other tuple

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 <: Tuple] = X match { case _$16 *: 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 Any => EmptyTuple }

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

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

Attributes

Inherited and Abstract types

The names of the product elements

The names of the product elements

Attributes

Inherited from:
Mirror

The name of the type

The name of the type

Attributes

Inherited from:
Mirror

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

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]): m.MirroredElemTypes
def unapply(x: EmptyTuple): true

Matches an empty tuple.

Matches an empty tuple.

Attributes