-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Missing @implicitNotFound for ApplicativeError and MonadError #4059
Comments
These errors frequently trip me up, and not just in Cats proper. E.g. if something in the CE hierarchy is missing then it says you are missing |
Scala 3 inherits these definitions while Scala 2 does not. This has generated… no small amount of confusion. :-) Basically the consequence of this is the fact that in any typeclass hierarchy which has one |
Seems that Scala 2 also uses the inherited annotation (notice the sentence in parentheses):
But the overall error message is a way easier to decipher. At least it provides some clue where to start looking at. |
Why does |
And is that an argument against inheritance of |
Yes, I agree, I'm pretty sure we don't need these I experimented in a scastie (2.13) and it seems the default is to use the FQCN? trait Applicative[F[_]]
trait Foo[A]
implicitly[Applicative[Foo]]
// could not find implicit value for parameter e: Playground.Applicative[Playground.Foo] Update: same on 2.12. Maybe some ancient scalac was much less friendly about these. |
Lol, apparently this inheritance issue was known at the time! #581 (comment)
|
Hmm so it's coming from simulacrum 🤔 , but the message never included the suggestion to import |
Let's just remove the annotations. I don't think they're carrying any weight. |
Does that mean making a change in simulacrum, and re-running it here? Not sure how that stuff works. |
We can just do it manually. Cats no longer uses simulacrum because the latter isn't compatible with Scala 3. Travis wrote a simulacrum-scalafix which kind of does the same thing, but I don't think it is run on an ongoing basis. I would need to check. |
Check it out:
But in fact,
Applicative[Option]
DOES exist in the scope.The error message for the above should look like: "Could not find an instance of ApplicativeError[Option, Int]" instead.
The reason why it is incorrect is that
ApplicativeError
does not have@implicitNotFound
annotation applied and compiler picks one up from its parent.The text was updated successfully, but these errors were encountered: