Tuple

scala.Tuple
See theTuple companion trait
object Tuple

Attributes

Companion
trait
Source
Tuple.scala
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

Source
Tuple.scala
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

Source
Tuple.scala
type Contains[X <: Tuple, Y] = X match { case Y *: _$14 => true case _$15 *: 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

Source
Tuple.scala
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

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

Attributes

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

Attributes

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

Attributes

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

Attributes

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

Attributes

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

Type of the head of a tuple

Type of the head of a tuple

Attributes

Source
Tuple.scala
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

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)

Attributes

Source
Tuple.scala
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

Source
Tuple.scala
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

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

Attributes

Source
Tuple.scala
type Reverse[X <: Tuple] = ReverseOnto[X, EmptyTuple]

Type of the reversed tuple

Type of the reversed tuple

Attributes

Source
Tuple.scala
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

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

Attributes

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

Attributes

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

Type of the tail of a tuple

Type of the tail of a tuple

Attributes

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

Attributes

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

Source
Tuple.scala
type Zip[T1 <: Tuple, T2 <: Tuple] = (T1, T2) match { case (h1 *: t1, h2 *: t2) => (h1, h2) *: Zip[t1, t2] case (EmptyTuple, _$16) => EmptyTuple case (_$17, 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

Source
Tuple.scala

Value members

Concrete methods

def apply(): EmptyTuple

Empty tuple

Empty tuple

Attributes

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

Tuple with one element

Tuple with one element

Attributes

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

Attributes

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

Attributes

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

Attributes

Source
Tuple.scala
def fromProductTyped[P <: Product](p: P)(using m: ProductOf[P]): m.MirroredElemTypes

Attributes

Source
Tuple.scala
def unapply(x: EmptyTuple): true

Matches an empty tuple.

Matches an empty tuple.

Attributes

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]

Attributes

Source
Tuple.scala