Type variance error in Scala when doing a foldLeft over Traversable views
问题 I am trying concatenate a series of Traversable views in Scala using a foldLeft operator and am hitting type variance errors that I don't understand. I can use reduce to concatenate a list of Traversable views like so. val xs = List(1,2,3,4).map(Traversable(_).view).reduce((a: TraversableView[Int, Traversable[_]], b: TraversableView[Int, Traversable[_]]) => a ++ b) // TraversableView[Int,Traversable[_]] // xs.force returns Traversable[Int] = List(1, 2, 3, 4) (Note that I have to write the