TupleProtocol

Generalized algebraic product types

Swift’s built-in tuple types are algebraic product types, but since they are not nominal and not easily decomposed, they don’t lend themselves to many types of useful processing. Models of TupleProtocol don’t have those problems.

  • The type of the first element.

  • An algebriac product formed by composing the types of all but the first element.

  • The first element.

  • All elements but the first.

  • The number of elements