Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type bounds #22

Closed
marklister opened this issue Nov 1, 2014 · 4 comments
Closed

Type bounds #22

marklister opened this issue Nov 1, 2014 · 4 comments

Comments

@marklister
Copy link
Owner

#20 and #21 exposed a probable bug in scala relating to tupled on a FunctionN. The workaround is to return Tuples in the Iterators not Products but this exposes some incorrect type assumptions made in product-collections...

@ms-tg
Copy link

ms-tg commented Nov 3, 2014

Hi @marklister, didn't really understand this bug. Can you explain a bit?

@marklister
Copy link
Owner Author

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.

@marklister
Copy link
Owner Author

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 aabb0ad.

@ms-tg
Copy link

ms-tg commented Nov 4, 2014

Nice workaround!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants