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

Investigate ambiguous extension methods when trying to call map on OptionT #1

Closed
mpilquist opened this issue May 29, 2019 · 2 comments · Fixed by #14
Closed

Investigate ambiguous extension methods when trying to call map on OptionT #1

mpilquist opened this issue May 29, 2019 · 2 comments · Fixed by #14

Comments

@mpilquist
Copy link
Member

mpilquist commented May 29, 2019

@Test def map(): Unit = {
val x = OptionT.fromOption[F = List](Some(42))
// https://github.com/typelevel/spotted-leopards/issues/1
// x.map(_ + 1)
// // Fails to compile with:
// // [error] -- [E008] Member Not Found Error: spotted-leopards/src/test/scala/leopards/OptionTTest.scala:9:6
// // [error] 9 | x.map(_ + 1)
// // [error] | ^^^^^
// // [error] |value map is not a member of leopards.OptionT.OptionT[List, Int] - did you mean x.==?.
// // [error] |An extension method was tried, but could not be fully constructed:
// // [error] |
// // [error] | leopards.OptionT$package.OptionT.FunctorInstance[([_$15] => Any)](
// // [error] | /* ambiguous */implicitly[leopards.Functor[([_$15] => Any)]]
// // [error] | ).map()
// assertEquals(x.value, List(Some(43)))
}

@mpilquist
Copy link
Member Author

With 3.0.0-RC3:

[error] 14 |    x.map(_ + 1)
[error]    |    ^^^^^
[error]    |value map is not a member of leopards.OptionT[List, Int].
[error]    |An extension method was tried, but could not be fully constructed:
[error]    |
[error]    |    leopards.OptionT.given_Functor_OptionT[F](
[error]    |      /* ambiguous: both object given_Monad_List_Traverse_List in package leopards and object given_Monad_Option_Traverse_Option in package leopards match type leopards.Functor[F] */
[error]    |        summon[leopards.Functor[F]]
[error]    |    ).map()

@smarter
Copy link

smarter commented Sep 17, 2021

Looks like this was the same issue as #2 and is also fixed in scalaVersion := "3.1.1-RC1-bin-20210916-dd6da26-NIGHTLY"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants