@@ -41,10 +41,9 @@ import caps.unsafe.untrackedCaptures
4141 * `String`.
4242 *
4343 * {{{
44- * import scala.collection.{Iterable, IterableOps}
4544 * import scala.collection.generic.IsIterable
4645 *
47- * class ExtensionMethods [Repr, I <: IsIterable[Repr]](coll: Repr, it: I) {
46+ * extension [Repr, I <: IsIterable[Repr]](coll: Repr)(using it: I) {
4847 * def mapReduce[B](mapper: it.A => B)(reducer: (B, B) => B): B = {
4948 * val iter = it(coll).iterator
5049 * var res = mapper(iter.next())
@@ -54,9 +53,6 @@ import caps.unsafe.untrackedCaptures
5453 * }
5554 * }
5655 *
57- * implicit def withExtensions[Repr](coll: Repr)(implicit it: IsIterable[Repr]): ExtensionMethods[Repr, it.type] =
58- * new ExtensionMethods(coll, it)
59- *
6056 * // See it in action!
6157 * List(1, 2, 3).mapReduce(_ * 2)(_ + _) // res0: Int = 12
6258 * "Yeah, well, you know, that's just, like, your opinion, man.".mapReduce(x => 1)(_ + _) // res1: Int = 59
@@ -88,10 +84,6 @@ import caps.unsafe.untrackedCaptures
8884 * (See the `IsIterable` companion object, which contains a precise
8985 * specification of the available implicits.)
9086 *
91- * ''Note'': Currently, it's not possible to combine the implicit conversion and
92- * the class with the extension methods into an implicit class due to
93- * limitations of type inference.
94- *
9587 * ===Implementing `IsIterable` for New Types===
9688 *
9789 * One must simply provide an implicit value of type `IsIterable`
0 commit comments