You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importscala.concurrent._importExecutionContext.Implicits.globalFuture.traverse(1 to 3)( Future.successful ) // compilesFuture.traverse(1 until 3)( Future.successful ) // compile error
error: Cannot construct a collection of type scala.collection.AbstractSeq[Int]
with elements of type Int based on a collection of type scala.collection.AbstractSeq[Int].
Future.traverse(1 until 3)( Future.successful )
^
Is there a problem with generic.CanBuildFrom and Range ?
// example working with Range and Inclusivedeftraverse[A,M[_]](list: M[A]) =1
traverse(1 to 3) // compiles
traverse(1 until 3) // compiles!
Now the same example, but with generic.CanBuildFrom
(copied out off the source of scala.concurrent.Future.traverse)
// same example, CanBuildFrom addedimportscala.collection.generic.CanBuildFromdeftraverse[A,M[_]](list: M[A])( implicitcbf: CanBuildFrom[M[A],A,M[A]] ) =1
traverse(1 to 3) // compiles
traverse(1 until 3) // does not compile!// needs a little help
traverse[Int,Seq](1 until 3) // does compile!// the other way roundvalincl:Range=1 to 3
traverse( incl ) // does not compile!
The text was updated successfully, but these errors were encountered:
@retronym said:
This is a variation of #6948, which stems from a weakness in type constructor inference and the addition of a new parant, AbstractSeq, in Scala 2.10.0.
Is there a problem with generic.CanBuildFrom and Range ?
Now the same example, but with generic.CanBuildFrom
(copied out off the source of scala.concurrent.Future.traverse)
The text was updated successfully, but these errors were encountered: