All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
org.specs2.data.Tuples.scala Maven / Gradle / Ivy
package org.specs2
package data
/**
* Utility methods for tuples to flatten 3-tuples and 4-tuples
*/
private[specs2]
trait Tuples { outer =>
implicit def toFlattenedTuple3[T1, T2, T3](t: ((T1, T2), T3)) = new FlattenedTuple3(t)
case class FlattenedTuple3[T1, T2, T3](t: ((T1, T2), T3)) {
def flatten = outer.flatten(t)
}
implicit def toFlattenedTuple4[T1, T2, T3, T4](t: (((T1, T2), T3), T4)) = new FlattenedTuple4(t)
case class FlattenedTuple4[T1, T2, T3, T4](t: (((T1, T2), T3), T4)) {
def flatten = outer.flatten(t)
}
def flatten[T1, T2, T3](t: ((T1, T2), T3)): (T1, T2, T3) = (t._1._1, t._1._2, t._2)
def flatten[T1, T2, T3, T4](t: (((T1, T2), T3), T4)): (T1, T2, T3, T4) = {
val f = flatten(t._1)
(f._1, f._2, f._3, t._2)
}
}
private[specs2]
object Tuples extends Tuples
trait TuplesToSeq {
implicit def tupleToSeq2[T,T1,T2] (t: (T1,T2)) (implicit e1:T1<: