@@ -32,8 +32,7 @@ object CsvRowEncoder {
3232 * This is "unsafe" because it relies on the caller to ensure that the headers match the produced values.
3333 * Failure to do so will blow up at runtime with an exception (for unequal lengths) or wrong output (for wrong order).
3434 */
35- def unsafeStatic [T , Header ](hs : NonEmptyList [Header ])(
36- f : T => NonEmptyList [String ]): StaticCsvRowEncoder [T , Header ] =
35+ def unsafeStatic [T , Header ](hs : NonEmptyList [Header ])(f : T => NonEmptyList [String ]): StaticCsvRowEncoder [T , Header ] =
3736 new CsvRowEncoder [T , Header ] with StaticHeaders [T , Header ] {
3837 override val headers : NonEmptyList [Header ] = hs
3938 override def apply (t : T ): CsvRow [Header ] = CsvRow .unsafe(f(t), hs)
@@ -42,8 +41,7 @@ object CsvRowEncoder {
4241 def forColumns [T , H , C1 : CellEncoder ](h1 : H )(f : T => C1 ): StaticCsvRowEncoder [T , H ] =
4342 unsafeStatic(NonEmptyList .one(h1))(t => NonEmptyList .one(CellEncoder [C1 ].apply(f(t))))
4443
45- def forColumns [T , H , C1 : CellEncoder , C2 : CellEncoder ](h1 : H , h2 : H )(
46- f : T => (C1 , C2 )): StaticCsvRowEncoder [T , H ] =
44+ def forColumns [T , H , C1 : CellEncoder , C2 : CellEncoder ](h1 : H , h2 : H )(f : T => (C1 , C2 )): StaticCsvRowEncoder [T , H ] =
4745 unsafeStatic(NonEmptyList .of(h1, h2)) { t =>
4846 val (c1, c2) = f(t)
4947 NonEmptyList .of(CellEncoder [C1 ].apply(c1), CellEncoder [C2 ].apply(c2))
@@ -56,11 +54,8 @@ object CsvRowEncoder {
5654 NonEmptyList .of(CellEncoder [C1 ].apply(c1), CellEncoder [C2 ].apply(c2), CellEncoder [C3 ].apply(c3))
5755 }
5856
59- def forColumns [T , H , C1 : CellEncoder , C2 : CellEncoder , C3 : CellEncoder , C4 : CellEncoder ](
60- h1 : H ,
61- h2 : H ,
62- h3 : H ,
63- h4 : H )(f : T => (C1 , C2 , C3 , C4 )): StaticCsvRowEncoder [T , H ] =
57+ def forColumns [T , H , C1 : CellEncoder , C2 : CellEncoder , C3 : CellEncoder , C4 : CellEncoder ](h1 : H , h2 : H , h3 : H , h4 : H )(
58+ f : T => (C1 , C2 , C3 , C4 )): StaticCsvRowEncoder [T , H ] =
6459 unsafeStatic(NonEmptyList .of(h1, h2, h3, h4)) { t =>
6560 val (c1, c2, c3, c4) = f(t)
6661 NonEmptyList .of(CellEncoder [C1 ].apply(c1),
@@ -69,12 +64,12 @@ object CsvRowEncoder {
6964 CellEncoder [C4 ].apply(c4))
7065 }
7166
72- def forColumns [T , H , C1 : CellEncoder , C2 : CellEncoder , C3 : CellEncoder , C4 : CellEncoder , C5 : CellEncoder ](
73- h1 : H ,
74- h2 : H ,
75- h3 : H ,
76- h4 : H ,
77- h5 : H )( f : T => (C1 , C2 , C3 , C4 , C5 )): StaticCsvRowEncoder [T , H ] =
67+ def forColumns [T , H , C1 : CellEncoder , C2 : CellEncoder , C3 : CellEncoder , C4 : CellEncoder , C5 : CellEncoder ](h1 : H ,
68+ h2 : H ,
69+ h3 : H ,
70+ h4 : H ,
71+ h5 : H )(
72+ f : T => (C1 , C2 , C3 , C4 , C5 )): StaticCsvRowEncoder [T , H ] =
7873 unsafeStatic(NonEmptyList .of(h1, h2, h3, h4, h5)) { t =>
7974 val (c1, c2, c3, c4, c5) = f(t)
8075 NonEmptyList .of(CellEncoder [C1 ].apply(c1),
@@ -95,12 +90,14 @@ object CsvRowEncoder {
9590 f : T => (C1 , C2 , C3 , C4 , C5 , C6 )): StaticCsvRowEncoder [T , H ] =
9691 unsafeStatic(NonEmptyList .of(h1, h2, h3, h4, h5, h6)) { t =>
9792 val (c1, c2, c3, c4, c5, c6) = f(t)
98- NonEmptyList .of(CellEncoder [C1 ].apply(c1),
99- CellEncoder [C2 ].apply(c2),
100- CellEncoder [C3 ].apply(c3),
101- CellEncoder [C4 ].apply(c4),
102- CellEncoder [C5 ].apply(c5),
103- CellEncoder [C6 ].apply(c6))
93+ NonEmptyList .of(
94+ CellEncoder [C1 ].apply(c1),
95+ CellEncoder [C2 ].apply(c2),
96+ CellEncoder [C3 ].apply(c3),
97+ CellEncoder [C4 ].apply(c4),
98+ CellEncoder [C5 ].apply(c5),
99+ CellEncoder [C6 ].apply(c6)
100+ )
104101 }
105102
106103 def forColumns [T ,
@@ -523,8 +520,7 @@ object CsvRowEncoder {
523520 h15 : H ,
524521 h16 : H ,
525522 h17 : H )(
526- f : T => (C1 , C2 , C3 , C4 , C5 , C6 , C7 , C8 , C9 , C10 , C11 , C12 , C13 , C14 , C15 , C16 , C17 ))
527- : StaticCsvRowEncoder [T , H ] =
523+ f : T => (C1 , C2 , C3 , C4 , C5 , C6 , C7 , C8 , C9 , C10 , C11 , C12 , C13 , C14 , C15 , C16 , C17 )): StaticCsvRowEncoder [T , H ] =
528524 unsafeStatic(NonEmptyList .of(h1, h2, h3, h4, h5, h6, h7, h8, h9, h10, h11, h12, h13, h14, h15, h16, h17)) { t =>
529525 val (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17) = f(t)
530526 NonEmptyList .of(
@@ -723,31 +719,30 @@ object CsvRowEncoder {
723719 f : T => (C1 , C2 , C3 , C4 , C5 , C6 , C7 , C8 , C9 , C10 , C11 , C12 , C13 , C14 , C15 , C16 , C17 , C18 , C19 , C20 ))
724720 : StaticCsvRowEncoder [T , H ] =
725721 unsafeStatic(
726- NonEmptyList .of(h1, h2, h3, h4, h5, h6, h7, h8, h9, h10, h11, h12, h13, h14, h15, h16, h17, h18, h19, h20)) {
727- t =>
728- val (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20) = f(t)
729- NonEmptyList .of(
730- CellEncoder [C1 ].apply(c1),
731- CellEncoder [C2 ].apply(c2),
732- CellEncoder [C3 ].apply(c3),
733- CellEncoder [C4 ].apply(c4),
734- CellEncoder [C5 ].apply(c5),
735- CellEncoder [C6 ].apply(c6),
736- CellEncoder [C7 ].apply(c7),
737- CellEncoder [C8 ].apply(c8),
738- CellEncoder [C9 ].apply(c9),
739- CellEncoder [C10 ].apply(c10),
740- CellEncoder [C11 ].apply(c11),
741- CellEncoder [C12 ].apply(c12),
742- CellEncoder [C13 ].apply(c13),
743- CellEncoder [C14 ].apply(c14),
744- CellEncoder [C15 ].apply(c15),
745- CellEncoder [C16 ].apply(c16),
746- CellEncoder [C17 ].apply(c17),
747- CellEncoder [C18 ].apply(c18),
748- CellEncoder [C19 ].apply(c19),
749- CellEncoder [C20 ].apply(c20)
750- )
722+ NonEmptyList .of(h1, h2, h3, h4, h5, h6, h7, h8, h9, h10, h11, h12, h13, h14, h15, h16, h17, h18, h19, h20)) { t =>
723+ val (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20) = f(t)
724+ NonEmptyList .of(
725+ CellEncoder [C1 ].apply(c1),
726+ CellEncoder [C2 ].apply(c2),
727+ CellEncoder [C3 ].apply(c3),
728+ CellEncoder [C4 ].apply(c4),
729+ CellEncoder [C5 ].apply(c5),
730+ CellEncoder [C6 ].apply(c6),
731+ CellEncoder [C7 ].apply(c7),
732+ CellEncoder [C8 ].apply(c8),
733+ CellEncoder [C9 ].apply(c9),
734+ CellEncoder [C10 ].apply(c10),
735+ CellEncoder [C11 ].apply(c11),
736+ CellEncoder [C12 ].apply(c12),
737+ CellEncoder [C13 ].apply(c13),
738+ CellEncoder [C14 ].apply(c14),
739+ CellEncoder [C15 ].apply(c15),
740+ CellEncoder [C16 ].apply(c16),
741+ CellEncoder [C17 ].apply(c17),
742+ CellEncoder [C18 ].apply(c18),
743+ CellEncoder [C19 ].apply(c19),
744+ CellEncoder [C20 ].apply(c20)
745+ )
751746 }
752747
753748 def forColumns [T ,
@@ -873,33 +868,32 @@ object CsvRowEncoder {
873868 : StaticCsvRowEncoder [T , H ] =
874869 unsafeStatic(
875870 NonEmptyList
876- .of(h1, h2, h3, h4, h5, h6, h7, h8, h9, h10, h11, h12, h13, h14, h15, h16, h17, h18, h19, h20, h21, h22)) {
877- t =>
878- val (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22) =
879- f(t)
880- NonEmptyList .of(
881- CellEncoder [C1 ].apply(c1),
882- CellEncoder [C2 ].apply(c2),
883- CellEncoder [C3 ].apply(c3),
884- CellEncoder [C4 ].apply(c4),
885- CellEncoder [C5 ].apply(c5),
886- CellEncoder [C6 ].apply(c6),
887- CellEncoder [C7 ].apply(c7),
888- CellEncoder [C8 ].apply(c8),
889- CellEncoder [C9 ].apply(c9),
890- CellEncoder [C10 ].apply(c10),
891- CellEncoder [C11 ].apply(c11),
892- CellEncoder [C12 ].apply(c12),
893- CellEncoder [C13 ].apply(c13),
894- CellEncoder [C14 ].apply(c14),
895- CellEncoder [C15 ].apply(c15),
896- CellEncoder [C16 ].apply(c16),
897- CellEncoder [C17 ].apply(c17),
898- CellEncoder [C18 ].apply(c18),
899- CellEncoder [C19 ].apply(c19),
900- CellEncoder [C20 ].apply(c20),
901- CellEncoder [C21 ].apply(c21),
902- CellEncoder [C22 ].apply(c22)
903- )
871+ .of(h1, h2, h3, h4, h5, h6, h7, h8, h9, h10, h11, h12, h13, h14, h15, h16, h17, h18, h19, h20, h21, h22)) { t =>
872+ val (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22) =
873+ f(t)
874+ NonEmptyList .of(
875+ CellEncoder [C1 ].apply(c1),
876+ CellEncoder [C2 ].apply(c2),
877+ CellEncoder [C3 ].apply(c3),
878+ CellEncoder [C4 ].apply(c4),
879+ CellEncoder [C5 ].apply(c5),
880+ CellEncoder [C6 ].apply(c6),
881+ CellEncoder [C7 ].apply(c7),
882+ CellEncoder [C8 ].apply(c8),
883+ CellEncoder [C9 ].apply(c9),
884+ CellEncoder [C10 ].apply(c10),
885+ CellEncoder [C11 ].apply(c11),
886+ CellEncoder [C12 ].apply(c12),
887+ CellEncoder [C13 ].apply(c13),
888+ CellEncoder [C14 ].apply(c14),
889+ CellEncoder [C15 ].apply(c15),
890+ CellEncoder [C16 ].apply(c16),
891+ CellEncoder [C17 ].apply(c17),
892+ CellEncoder [C18 ].apply(c18),
893+ CellEncoder [C19 ].apply(c19),
894+ CellEncoder [C20 ].apply(c20),
895+ CellEncoder [C21 ].apply(c21),
896+ CellEncoder [C22 ].apply(c22)
897+ )
904898 }
905899}
0 commit comments