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

WriterTInstances: insufficient prioritization? #3385

Closed
chwthewke opened this issue Apr 7, 2020 · 2 comments · Fixed by #3394
Closed

WriterTInstances: insufficient prioritization? #3385

chwthewke opened this issue Apr 7, 2020 · 2 comments · Fixed by #3394

Comments

@chwthewke
Copy link
Contributor

The following snippet:

  import cats.instances.int._

  Functor[Writer[Int, *]]

fails to compile with

[E]      ambiguous implicit values:
[E]       both method catsDataCommutativeMonadForWriterT in class WriterTInstances of type [F[_], L](implicit F: cats.CommutativeMonad[F], implicit L: cats.kernel.CommutativeMonoid[L])cats.CommutativeMonad[[?$3$]cats.data.WriterT[F,L,?$3$]]
[E]       and method catsDataTraverseForWriterTId in class WriterTInstances of type [L](implicit F: cats.Traverse[cats.Id])cats.Traverse[[?$5$]cats.data.WriterT[[A]A,L,?$5$]]
[E]       match expected type cats.Functor[[?$0$]cats.data.WriterT[[A]A,Int,?$0$]]
[E]      L9:   Functor[Writer[Int, *]]

It's a silly type, but one that I actually wanted to use for real (in tests).

It seems the two aforementioned methods might need to be be in different "levels" of the WriterTInstances "tower"? To be honest, I'm quite a bit handwavy on how these work exactly, also I have not a single clue on the bincompat implications, so I'm not really able to suggest a fix in a more precise fashion.

Thank you for your consideration

@djspiewak
Copy link
Member

I agree this is a real issue. They should be factored across two traits.

@barambani
Copy link
Contributor

I'll look into this

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

Successfully merging a pull request may close this issue.

4 participants