In scala 2.13 TraverseableOnce is going away. We always allowed A => TraversableOnce[B] on the idea we could work with Iterators.
We never noticed that those two types are almost equivalent. Since the main subclasses of TraversableOnce[A] are either Iterator[A] or Iterable[A] we could have:
implicit def toIterableFn[A, B](fn: A => Iterator[B]): A => Iterable[B] = { (a: A) =>
new Iterable[B] {
def iterator = fn(a)
}
}
I think @non has a fully lazy Iterable somewhere that we could use there (it is always just a transformer on a () => Iterator[A]).
In scala 2.13 TraverseableOnce is going away. We always allowed
A => TraversableOnce[B]
on the idea we could work with Iterators.We never noticed that those two types are almost equivalent. Since the main subclasses of
TraversableOnce[A]
are eitherIterator[A]
orIterable[A]
we could have:I think @non has a fully lazy Iterable somewhere that we could use there (it is always just a transformer on a
() => Iterator[A]
).