Skip to content
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

Error in IsTraversableLike scaladoc example #6924

Closed
scabug opened this issue Jan 6, 2013 · 2 comments
Closed

Error in IsTraversableLike scaladoc example #6924

scabug opened this issue Jan 6, 2013 · 2 comments
Assignees
Labels
Milestone

Comments

@scabug
Copy link

@scabug scabug commented Jan 6, 2013

The header example is

class FilterMapImpl[A, Repr](val r: GenTraversableLike[A, Repr]) {
  final def filterMap[B, That](f: A => Option[B])(implicit cbf: CanBuildFrom[Repr, B, That]): That =
    r.flatMap(f(_).toSeq)
}
implicit def filterMap[Repr, A](r: Repr)(implicit fr: IsTraversableOnce[Repr]): FilterMapImpl[fr.A,Repr] =
  new FilterMapImpl(fr.conversion(r))

But it won't compile. The implicit parameter fr should be of type IsTraversableLike. Furthermore, type parameter A in filterMap is not used and just confusing. It should be removed:

class FilterMapImpl[A, Repr](val r: GenTraversableLike[A, Repr]) {
  final def filterMap[B, That](f: A => Option[B])(implicit cbf: CanBuildFrom[Repr, B, That]): That =
    r.flatMap(f(_).toSeq)
}
implicit def filterMap[Repr](r: Repr)(implicit fr: IsTraversableLike[Repr]): FilterMapImpl[fr.A,Repr] =
  new FilterMapImpl(fr.conversion(r))

Furthermore, since this triggers a feature warning, I guess it should use an implicit class now.

@scabug
Copy link
Author

@scabug scabug commented Jan 6, 2013

Imported From: https://issues.scala-lang.org/browse/SI-6924?orig=1
Reporter: @Sciss
Affected Versions: 2.10.0

@scabug
Copy link
Author

@scabug scabug commented Jan 14, 2013

@scabug scabug closed this Jan 14, 2013
@scabug scabug added the docs label Apr 7, 2017
@scabug scabug added this to the 2.10.1 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants