-
Notifications
You must be signed in to change notification settings - Fork 404
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
Gen.sequence seems to forget that ScalaCheck is a Scala lib (1.12.1) #131
Comments
Stumbled on this. It's very annoying. |
It actually is very aware that it is Scala, and that Scala is not very good As usual in Scala, some judicious use of explicit type parameters solves scala> val genBarList = for { ints <- genInts; bars <- cheers, On 26 May 2015 at 07:32, Allan Douglas R. de Oliveira <
|
@jedws in my example above, I offer exactly your proposed solution in The point here, however, is that without explicit type parameters the resultant One would think that a Scala library method would try to infer first to Scala types, e.g. here Scala collections. Instead, we see that |
@devmage sorry, didn't see your solution Unfortunately, Scala's type inference is not very good. It is often necessary to explicitly annotate in places where it seems silly and that the compiler should do a better job of it. Could scalacheck have a better signature, or provide a better default |
Consider the following console session, with ScalaCheck 1.12.1:
Incidentally, the type parameters on
genBarList2
cause IntelliJ to refuse to compile, although sbt and the REPL are fine with it.To get back to Scala-land, I have to import
scala.collection.JavaConverters._
and map on the generator with.map(_.asScala.toList)
.Happy New Year! 😃
The text was updated successfully, but these errors were encountered: