Closed marklister closed 9 years ago
Hi @marklister, didn't really understand this bug. Can you explain a bit?
Creating a CollSeq from a Seq[TupleN] fails because the lib is expecting a Seq[ProductN]. It's not to hard to workaround (use : _ * or specify the type as Iterator[ProductN]) but the real fix is to set the upper bound of CollSeq.apply () to ProductN.
This came up because I had to produce an Iterator[TupleN] instead of an Iterator[ProductN] on the i/o component to work around a probable scala bug.
It's only likely to affect people who are trying to create CollSeqs using the iterator I exposed last week.
scala> CsvParser[String,Int,Double].iterator(new java.io.FileReader("sample.csv")).toSeq
res2: Seq[(String, Int, Double)] = Stream((Jan,10,22.33), ?)
scala> CollSeq(res2 :_*)
res4: com.github.marklister.collections.immutable.CollSeq3[String,Int,Double] =
CollSeq((Jan,10,22.33),
(Feb,20,44.2),
(Mar,25,55.1))
More attention could be paid to type bounds in the future but right now I think this is good enough for government work. Closing with aabb0ad17f2b4059178f86ca2e8655ddd7c8d26d.
Nice workaround!
20 and #21 exposed a probable bug in scala relating to
tupled
on aFunctionN
. The workaround is to returnTuples
in theIterator
s notProduct
s but this exposes some incorrect type assumptions made in product-collections...