Skip to content

Instantly share code, notes, and snippets.

@cvogt
Created July 6, 2013 22:21
Show Gist options
  • Save cvogt/5941501 to your computer and use it in GitHub Desktop.
Save cvogt/5941501 to your computer and use it in GitHub Desktop.
tuple matching helper methods
package util
/**
* tuple helpers for safely adding and matching elements
*/
package object tuples{
// first element extractor
object +:{
def unapply[T1,T2](t: Tuple2[T1,T2]) = Some( t._1, Tuple1(t._2) )
def unapply[T1,T2,T3](t: Tuple3[T1,T2,T3]) = Some( t._1, Tuple2(t._2,t._3) )
def unapply[T1,T2,T3,T4](t: Tuple4[T1,T2,T3,T4]) = Some( t._1, Tuple3(t._2,t._3,t._4) )
def unapply[T1,T2,T3,T4,T5](t: Tuple5[T1,T2,T3,T4,T5]) = Some( t._1, Tuple4(t._2,t._3,t._4,t._5) )
def unapply[T1,T2,T3,T4,T5,T6](t: Tuple6[T1,T2,T3,T4,T5,T6]) = Some( t._1, Tuple5(t._2,t._3,t._4,t._5,t._6) )
def unapply[T1,T2,T3,T4,T5,T6,T7](t: Tuple7[T1,T2,T3,T4,T5,T6,T7]) = Some( t._1, Tuple6(t._2,t._3,t._4,t._5,t._6,t._7) )
def unapply[T1,T2,T3,T4,T5,T6,T7,T8](t: Tuple8[T1,T2,T3,T4,T5,T6,T7,T8]) = Some( t._1, Tuple7(t._2,t._3,t._4,t._5,t._6,t._7,t._8) )
def unapply[T1,T2,T3,T4,T5,T6,T7,T8,T9](t: Tuple9[T1,T2,T3,T4,T5,T6,T7,T8,T9]) = Some( t._1, Tuple8(t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9) )
def unapply[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10](t: Tuple10[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10]) = Some( t._1, Tuple9(t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10) )
def unapply[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11](t: Tuple11[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11]) = Some( t._1, Tuple10(t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11) )
def unapply[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12](t: Tuple12[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12]) = Some( t._1, Tuple11(t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12) )
def unapply[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13](t: Tuple13[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13]) = Some( t._1, Tuple12(t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13) )
def unapply[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14](t: Tuple14[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14]) = Some( t._1, Tuple13(t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13,t._14) )
def unapply[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15](t: Tuple15[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15]) = Some( t._1, Tuple14(t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13,t._14,t._15) )
def unapply[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16](t: Tuple16[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16]) = Some( t._1, Tuple15(t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13,t._14,t._15,t._16) )
def unapply[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17](t: Tuple17[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17]) = Some( t._1, Tuple16(t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13,t._14,t._15,t._16,t._17) )
def unapply[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18](t: Tuple18[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18]) = Some( t._1, Tuple17(t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13,t._14,t._15,t._16,t._17,t._18) )
def unapply[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19](t: Tuple19[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19]) = Some( t._1, Tuple18(t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13,t._14,t._15,t._16,t._17,t._18,t._19) )
def unapply[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20](t: Tuple20[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20]) = Some( t._1, Tuple19(t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13,t._14,t._15,t._16,t._17,t._18,t._19,t._20) )
def unapply[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21](t: Tuple21[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21]) = Some( t._1, Tuple20(t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13,t._14,t._15,t._16,t._17,t._18,t._19,t._20,t._21) )
def unapply[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22](t: Tuple22[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22]) = Some( t._1, Tuple21(t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13,t._14,t._15,t._16,t._17,t._18,t._19,t._20,t._21,t._22) )
}
// last element extractor
object :+{
def unapply[T1,T2](t: (T1,T2)) = Some( (Tuple1(t._1),t._2) )
def unapply[T1,T2,T3](t: (T1,T2,T3)) = Some( (Tuple2(t._1,t._2),t._3) )
def unapply[T1,T2,T3,T4](t: (T1,T2,T3,T4)) = Some( (Tuple3(t._1,t._2,t._3),t._4) )
def unapply[T1,T2,T3,T4,T5](t: (T1,T2,T3,T4,T5)) = Some( (Tuple4(t._1,t._2,t._3,t._4),t._5) )
def unapply[T1,T2,T3,T4,T5,T6](t: (T1,T2,T3,T4,T5,T6)) = Some( (Tuple5(t._1,t._2,t._3,t._4,t._5),t._6) )
def unapply[T1,T2,T3,T4,T5,T6,T7](t: (T1,T2,T3,T4,T5,T6,T7)) = Some( (Tuple6(t._1,t._2,t._3,t._4,t._5,t._6),t._7) )
def unapply[T1,T2,T3,T4,T5,T6,T7,T8](t: (T1,T2,T3,T4,T5,T6,T7,T8)) = Some( (Tuple7(t._1,t._2,t._3,t._4,t._5,t._6,t._7),t._8) )
def unapply[T1,T2,T3,T4,T5,T6,T7,T8,T9](t: (T1,T2,T3,T4,T5,T6,T7,T8,T9)) = Some( (Tuple8(t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8),t._9) )
def unapply[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10](t: (T1,T2,T3,T4,T5,T6,T7,T8,T9,T10)) = Some( (Tuple9(t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9),t._10) )
def unapply[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11](t: (T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11)) = Some( (Tuple10(t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10),t._11) )
def unapply[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12](t: (T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12)) = Some( (Tuple11(t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11),t._12) )
def unapply[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13](t: (T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13)) = Some( (Tuple12(t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12),t._13) )
def unapply[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14](t: (T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14)) = Some( (Tuple13(t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13),t._14) )
def unapply[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15](t: (T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15)) = Some( (Tuple14(t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13,t._14),t._15) )
def unapply[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16](t: (T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16)) = Some( (Tuple15(t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13,t._14,t._15),t._16) )
def unapply[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17](t: (T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17)) = Some( (Tuple16(t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13,t._14,t._15,t._16),t._17) )
def unapply[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18](t: (T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18)) = Some( (Tuple17(t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13,t._14,t._15,t._16,t._17),t._18) )
def unapply[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19](t: (T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19)) = Some( (Tuple18(t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13,t._14,t._15,t._16,t._17,t._18),t._19) )
def unapply[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20](t: (T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20)) = Some( (Tuple19(t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13,t._14,t._15,t._16,t._17,t._18,t._19),t._20) )
def unapply[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21](t: (T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21)) = Some( (Tuple20(t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13,t._14,t._15,t._16,t._17,t._18,t._19,t._20),t._21) )
def unapply[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22](t: (T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22)) = Some( (Tuple21(t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13,t._14,t._15,t._16,t._17,t._18,t._19,t._20,t._21),t._22) )
}
// append and prepend extension methods
implicit def tuple1Append(a: Any) = new{
def :+[E]( e:E ) = Tuple2(a,e)
def +:[E]( e:E ) = Tuple2(e,a)
}
implicit def tuple1Append[T1](t: Tuple1[T1]) = new{
def :+[E]( e:E ) = Tuple2(t._1,e)
def +:[E]( e:E ) = Tuple2(e,t._1)
}
implicit def tuple2Append[T1,T2](t: Tuple2[T1,T2]) = new{
def :+[E]( e:E ) = Tuple3(t._1,t._2,e)
def +:[E]( e:E ) = Tuple3(e,t._1,t._2)
}
implicit def tuple3Append[T1,T2,T3](t: Tuple3[T1,T2,T3]) = new{
def :+[E]( e:E ) = Tuple4(t._1,t._2,t._3,e)
def +:[E]( e:E ) = Tuple4(e,t._1,t._2,t._3)
}
implicit def tuple4Append[T1,T2,T3,T4](t: Tuple4[T1,T2,T3,T4]) = new{
def :+[E]( e:E ) = Tuple5(t._1,t._2,t._3,t._4,e)
def +:[E]( e:E ) = Tuple5(e,t._1,t._2,t._3,t._4)
}
implicit def tuple5Append[T1,T2,T3,T4,T5](t: Tuple5[T1,T2,T3,T4,T5]) = new{
def :+[E]( e:E ) = Tuple6(t._1,t._2,t._3,t._4,t._5,e)
def +:[E]( e:E ) = Tuple6(e,t._1,t._2,t._3,t._4,t._5)
}
implicit def tuple6Append[T1,T2,T3,T4,T5,T6](t: Tuple6[T1,T2,T3,T4,T5,T6]) = new{
def :+[E]( e:E ) = Tuple7(t._1,t._2,t._3,t._4,t._5,t._6,e)
def +:[E]( e:E ) = Tuple7(e,t._1,t._2,t._3,t._4,t._5,t._6)
}
implicit def tuple7Append[T1,T2,T3,T4,T5,T6,T7](t: Tuple7[T1,T2,T3,T4,T5,T6,T7]) = new{
def :+[E]( e:E ) = Tuple8(t._1,t._2,t._3,t._4,t._5,t._6,t._7,e)
def +:[E]( e:E ) = Tuple8(e,t._1,t._2,t._3,t._4,t._5,t._6,t._7)
}
implicit def tuple8Append[T1,T2,T3,T4,T5,T6,T7,T8](t: Tuple8[T1,T2,T3,T4,T5,T6,T7,T8]) = new{
def :+[E]( e:E ) = Tuple9(t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,e)
def +:[E]( e:E ) = Tuple9(e,t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8)
}
implicit def tuple9Append[T1,T2,T3,T4,T5,T6,T7,T8,T9](t: Tuple9[T1,T2,T3,T4,T5,T6,T7,T8,T9]) = new{
def :+[E]( e:E ) = Tuple10(t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,e)
def +:[E]( e:E ) = Tuple10(e,t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9)
}
implicit def tuple10Append[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10](t: Tuple10[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10]) = new{
def :+[E]( e:E ) = Tuple11(t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,e)
def +:[E]( e:E ) = Tuple11(e,t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10)
}
implicit def tuple11Append[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11](t: Tuple11[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11]) = new{
def :+[E]( e:E ) = Tuple12(t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,e)
def +:[E]( e:E ) = Tuple12(e,t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11)
}
implicit def tuple12Append[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12](t: Tuple12[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12]) = new{
def :+[E]( e:E ) = Tuple13(t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,e)
def +:[E]( e:E ) = Tuple13(e,t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12)
}
implicit def tuple13Append[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13](t: Tuple13[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13]) = new{
def :+[E]( e:E ) = Tuple14(t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13,e)
def +:[E]( e:E ) = Tuple14(e,t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13)
}
implicit def tuple14Append[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14](t: Tuple14[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14]) = new{
def :+[E]( e:E ) = Tuple15(t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13,t._14,e)
def +:[E]( e:E ) = Tuple15(e,t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13,t._14)
}
implicit def tuple15Append[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15](t: Tuple15[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15]) = new{
def :+[E]( e:E ) = Tuple16(t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13,t._14,t._15,e)
def +:[E]( e:E ) = Tuple16(e,t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13,t._14,t._15)
}
implicit def tuple16Append[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16](t: Tuple16[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16]) = new{
def :+[E]( e:E ) = Tuple17(t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13,t._14,t._15,t._16,e)
def +:[E]( e:E ) = Tuple17(e,t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13,t._14,t._15,t._16)
}
implicit def tuple17Append[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17](t: Tuple17[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17]) = new{
def :+[E]( e:E ) = Tuple18(t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13,t._14,t._15,t._16,t._17,e)
def +:[E]( e:E ) = Tuple18(e,t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13,t._14,t._15,t._16,t._17)
}
implicit def tuple18Append[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18](t: Tuple18[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18]) = new{
def :+[E]( e:E ) = Tuple19(t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13,t._14,t._15,t._16,t._17,t._18,e)
def +:[E]( e:E ) = Tuple19(e,t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13,t._14,t._15,t._16,t._17,t._18)
}
implicit def tuple19Append[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19](t: Tuple19[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19]) = new{
def :+[E]( e:E ) = Tuple20(t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13,t._14,t._15,t._16,t._17,t._18,t._19,e)
def +:[E]( e:E ) = Tuple20(e,t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13,t._14,t._15,t._16,t._17,t._18,t._19)
}
implicit def tuple20Append[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20](t: Tuple20[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20]) = new{
def :+[E]( e:E ) = Tuple21(t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13,t._14,t._15,t._16,t._17,t._18,t._19,t._20,e)
def +:[E]( e:E ) = Tuple21(e,t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13,t._14,t._15,t._16,t._17,t._18,t._19,t._20)
}
implicit def tuple21Append[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21](t: Tuple21[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21]) = new{
def :+[E]( e:E ) = Tuple22(t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13,t._14,t._15,t._16,t._17,t._18,t._19,t._20,t._21,e)
def +:[E]( e:E ) = Tuple22(e,t._1,t._2,t._3,t._4,t._5,t._6,t._7,t._8,t._9,t._10,t._11,t._12,t._13,t._14,t._15,t._16,t._17,t._18,t._19,t._20,t._21)
}
implicit def tuple1Lift[T1](t: Tuple1[Option[T1]]) = new{
def liftOption = t match {
case Tuple1(Some(_1)) => Some(Tuple1(_1))
case _ => None
}
}
implicit def tuple2Lift[T1,T2](t: Tuple2[Option[T1],Option[T2]]) = new{
def liftOption = t match {
case Tuple2(Some(_1),Some(_2)) => Some(Tuple2(_1,_2))
case _ => None
}
}
implicit def tuple3Lift[T1,T2,T3](t: Tuple3[Option[T1],Option[T2],Option[T3]]) = new{
def liftOption = t match {
case Tuple3(Some(_1),Some(_2),Some(_3)) => Some(Tuple3(_1,_2,_3))
case _ => None
}
}
implicit def tuple4Lift[T1,T2,T3,T4](t: Tuple4[Option[T1],Option[T2],Option[T3],Option[T4]]) = new{
def liftOption = t match {
case Tuple4(Some(_1),Some(_2),Some(_3),Some(_4)) => Some(Tuple4(_1,_2,_3,_4))
case _ => None
}
}
implicit def tuple5Lift[T1,T2,T3,T4,T5](t: Tuple5[Option[T1],Option[T2],Option[T3],Option[T4],Option[T5]]) = new{
def liftOption = t match {
case Tuple5(Some(_1),Some(_2),Some(_3),Some(_4),Some(_5)) => Some(Tuple5(_1,_2,_3,_4,_5))
case _ => None
}
}
implicit def tuple6Lift[T1,T2,T3,T4,T5,T6](t: Tuple6[Option[T1],Option[T2],Option[T3],Option[T4],Option[T5],Option[T6]]) = new{
def liftOption = t match {
case Tuple6(Some(_1),Some(_2),Some(_3),Some(_4),Some(_5),Some(_6)) => Some(Tuple6(_1,_2,_3,_4,_5,_6))
case _ => None
}
}
implicit def tuple7Lift[T1,T2,T3,T4,T5,T6,T7](t: Tuple7[Option[T1],Option[T2],Option[T3],Option[T4],Option[T5],Option[T6],Option[T7]]) = new{
def liftOption = t match {
case Tuple7(Some(_1),Some(_2),Some(_3),Some(_4),Some(_5),Some(_6),Some(_7)) => Some(Tuple7(_1,_2,_3,_4,_5,_6,_7))
case _ => None
}
}
implicit def tuple8Lift[T1,T2,T3,T4,T5,T6,T7,T8](t: Tuple8[Option[T1],Option[T2],Option[T3],Option[T4],Option[T5],Option[T6],Option[T7],Option[T8]]) = new{
def liftOption = t match {
case Tuple8(Some(_1),Some(_2),Some(_3),Some(_4),Some(_5),Some(_6),Some(_7),Some(_8)) => Some(Tuple8(_1,_2,_3,_4,_5,_6,_7,_8))
case _ => None
}
}
implicit def tuple9Lift[T1,T2,T3,T4,T5,T6,T7,T8,T9](t: Tuple9[Option[T1],Option[T2],Option[T3],Option[T4],Option[T5],Option[T6],Option[T7],Option[T8],Option[T9]]) = new{
def liftOption = t match {
case Tuple9(Some(_1),Some(_2),Some(_3),Some(_4),Some(_5),Some(_6),Some(_7),Some(_8),Some(_9)) => Some(Tuple9(_1,_2,_3,_4,_5,_6,_7,_8,_9))
case _ => None
}
}
implicit def tuple10Lift[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10](t: Tuple10[Option[T1],Option[T2],Option[T3],Option[T4],Option[T5],Option[T6],Option[T7],Option[T8],Option[T9],Option[T10]]) = new{
def liftOption = t match {
case Tuple10(Some(_1),Some(_2),Some(_3),Some(_4),Some(_5),Some(_6),Some(_7),Some(_8),Some(_9),Some(_10)) => Some(Tuple10(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10))
case _ => None
}
}
implicit def tuple11Lift[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11](t: Tuple11[Option[T1],Option[T2],Option[T3],Option[T4],Option[T5],Option[T6],Option[T7],Option[T8],Option[T9],Option[T10],Option[T11]]) = new{
def liftOption = t match {
case Tuple11(Some(_1),Some(_2),Some(_3),Some(_4),Some(_5),Some(_6),Some(_7),Some(_8),Some(_9),Some(_10),Some(_11)) => Some(Tuple11(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11))
case _ => None
}
}
implicit def tuple12Lift[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12](t: Tuple12[Option[T1],Option[T2],Option[T3],Option[T4],Option[T5],Option[T6],Option[T7],Option[T8],Option[T9],Option[T10],Option[T11],Option[T12]]) = new{
def liftOption = t match {
case Tuple12(Some(_1),Some(_2),Some(_3),Some(_4),Some(_5),Some(_6),Some(_7),Some(_8),Some(_9),Some(_10),Some(_11),Some(_12)) => Some(Tuple12(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12))
case _ => None
}
}
implicit def tuple13Lift[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13](t: Tuple13[Option[T1],Option[T2],Option[T3],Option[T4],Option[T5],Option[T6],Option[T7],Option[T8],Option[T9],Option[T10],Option[T11],Option[T12],Option[T13]]) = new{
def liftOption = t match {
case Tuple13(Some(_1),Some(_2),Some(_3),Some(_4),Some(_5),Some(_6),Some(_7),Some(_8),Some(_9),Some(_10),Some(_11),Some(_12),Some(_13)) => Some(Tuple13(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13))
case _ => None
}
}
implicit def tuple14Lift[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14](t: Tuple14[Option[T1],Option[T2],Option[T3],Option[T4],Option[T5],Option[T6],Option[T7],Option[T8],Option[T9],Option[T10],Option[T11],Option[T12],Option[T13],Option[T14]]) = new{
def liftOption = t match {
case Tuple14(Some(_1),Some(_2),Some(_3),Some(_4),Some(_5),Some(_6),Some(_7),Some(_8),Some(_9),Some(_10),Some(_11),Some(_12),Some(_13),Some(_14)) => Some(Tuple14(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14))
case _ => None
}
}
implicit def tuple15Lift[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15](t: Tuple15[Option[T1],Option[T2],Option[T3],Option[T4],Option[T5],Option[T6],Option[T7],Option[T8],Option[T9],Option[T10],Option[T11],Option[T12],Option[T13],Option[T14],Option[T15]]) = new{
def liftOption = t match {
case Tuple15(Some(_1),Some(_2),Some(_3),Some(_4),Some(_5),Some(_6),Some(_7),Some(_8),Some(_9),Some(_10),Some(_11),Some(_12),Some(_13),Some(_14),Some(_15)) => Some(Tuple15(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15))
case _ => None
}
}
implicit def tuple16Lift[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16](t: Tuple16[Option[T1],Option[T2],Option[T3],Option[T4],Option[T5],Option[T6],Option[T7],Option[T8],Option[T9],Option[T10],Option[T11],Option[T12],Option[T13],Option[T14],Option[T15],Option[T16]]) = new{
def liftOption = t match {
case Tuple16(Some(_1),Some(_2),Some(_3),Some(_4),Some(_5),Some(_6),Some(_7),Some(_8),Some(_9),Some(_10),Some(_11),Some(_12),Some(_13),Some(_14),Some(_15),Some(_16)) => Some(Tuple16(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16))
case _ => None
}
}
implicit def tuple17Lift[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17](t: Tuple17[Option[T1],Option[T2],Option[T3],Option[T4],Option[T5],Option[T6],Option[T7],Option[T8],Option[T9],Option[T10],Option[T11],Option[T12],Option[T13],Option[T14],Option[T15],Option[T16],Option[T17]]) = new{
def liftOption = t match {
case Tuple17(Some(_1),Some(_2),Some(_3),Some(_4),Some(_5),Some(_6),Some(_7),Some(_8),Some(_9),Some(_10),Some(_11),Some(_12),Some(_13),Some(_14),Some(_15),Some(_16),Some(_17)) => Some(Tuple17(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17))
case _ => None
}
}
implicit def tuple18Lift[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18](t: Tuple18[Option[T1],Option[T2],Option[T3],Option[T4],Option[T5],Option[T6],Option[T7],Option[T8],Option[T9],Option[T10],Option[T11],Option[T12],Option[T13],Option[T14],Option[T15],Option[T16],Option[T17],Option[T18]]) = new{
def liftOption = t match {
case Tuple18(Some(_1),Some(_2),Some(_3),Some(_4),Some(_5),Some(_6),Some(_7),Some(_8),Some(_9),Some(_10),Some(_11),Some(_12),Some(_13),Some(_14),Some(_15),Some(_16),Some(_17),Some(_18)) => Some(Tuple18(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18))
case _ => None
}
}
implicit def tuple19Lift[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19](t: Tuple19[Option[T1],Option[T2],Option[T3],Option[T4],Option[T5],Option[T6],Option[T7],Option[T8],Option[T9],Option[T10],Option[T11],Option[T12],Option[T13],Option[T14],Option[T15],Option[T16],Option[T17],Option[T18],Option[T19]]) = new{
def liftOption = t match {
case Tuple19(Some(_1),Some(_2),Some(_3),Some(_4),Some(_5),Some(_6),Some(_7),Some(_8),Some(_9),Some(_10),Some(_11),Some(_12),Some(_13),Some(_14),Some(_15),Some(_16),Some(_17),Some(_18),Some(_19)) => Some(Tuple19(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19))
case _ => None
}
}
implicit def tuple20Lift[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20](t: Tuple20[Option[T1],Option[T2],Option[T3],Option[T4],Option[T5],Option[T6],Option[T7],Option[T8],Option[T9],Option[T10],Option[T11],Option[T12],Option[T13],Option[T14],Option[T15],Option[T16],Option[T17],Option[T18],Option[T19],Option[T20]]) = new{
def liftOption = t match {
case Tuple20(Some(_1),Some(_2),Some(_3),Some(_4),Some(_5),Some(_6),Some(_7),Some(_8),Some(_9),Some(_10),Some(_11),Some(_12),Some(_13),Some(_14),Some(_15),Some(_16),Some(_17),Some(_18),Some(_19),Some(_20)) => Some(Tuple20(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20))
case _ => None
}
}
implicit def tuple21Lift[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21](t: Tuple21[Option[T1],Option[T2],Option[T3],Option[T4],Option[T5],Option[T6],Option[T7],Option[T8],Option[T9],Option[T10],Option[T11],Option[T12],Option[T13],Option[T14],Option[T15],Option[T16],Option[T17],Option[T18],Option[T19],Option[T20],Option[T21]]) = new{
def liftOption = t match {
case Tuple21(Some(_1),Some(_2),Some(_3),Some(_4),Some(_5),Some(_6),Some(_7),Some(_8),Some(_9),Some(_10),Some(_11),Some(_12),Some(_13),Some(_14),Some(_15),Some(_16),Some(_17),Some(_18),Some(_19),Some(_20),Some(_21)) => Some(Tuple21(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21))
case _ => None
}
}
implicit def tuple22Lift[T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22](t: Tuple22[Option[T1],Option[T2],Option[T3],Option[T4],Option[T5],Option[T6],Option[T7],Option[T8],Option[T9],Option[T10],Option[T11],Option[T12],Option[T13],Option[T14],Option[T15],Option[T16],Option[T17],Option[T18],Option[T19],Option[T20],Option[T21],Option[T22]]) = new{
def liftOption = t match {
case Tuple22(Some(_1),Some(_2),Some(_3),Some(_4),Some(_5),Some(_6),Some(_7),Some(_8),Some(_9),Some(_10),Some(_11),Some(_12),Some(_13),Some(_14),Some(_15),Some(_16),Some(_17),Some(_18),Some(_19),Some(_20),Some(_21),Some(_22)) => Some(Tuple22(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22))
case _ => None
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment