Cats: Ambiguous implicit values for Functor[Kleisli[F, A, ?]]

Created on 13 Nov 2018  路  2Comments  路  Source: typelevel/cats

I see the next error in 1.4.0 and 1.5.0-RC0 cats:

 ambiguous implicit values:  both method catsDataApplicativeErrorForKleisli in class KleisliInstances4 of type [F[_], E, A](implicit F0: cats.ApplicativeError[F,E])cats.ApplicativeError[[纬$58$]cats.data.Kleisli[F,A,纬$58$],E]
[error]  and method catsDataFlatMapForKleisli in class KleisliInstances4 of type [F[_], A](implicit FM: cats.FlatMap[F])cats.FlatMap[[纬$59$]cats.data.Kleisli[F,A,纬$59$]]
[error]  match expected type cats.Functor[Kleisli[Result, NodeSeq, A]]
bug help wanted

Most helpful comment

On it 馃憤

All 2 comments

This a bug caused by the two methods at the same trait and thus priority. https://github.com/typelevel/cats/blob/master/core/src/main/scala/cats/data/Kleisli.scala#L294-L299

Looks like we can move either up or down. So we will have to insert a new trait into the chain
to reduce BC change maybe name it KleisliInstances4a?
We can place this new trait in between KleisliInstances4 and KleisliInstances5 and move one of the instances, say catsDataApplicativeErrorForKleisli to it, and to avoid a mima exception we can leave the original one but make it non-implicit.

On it 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

julien-truffaut picture julien-truffaut  路  3Comments

alexandru picture alexandru  路  4Comments

non picture non  路  3Comments

davidabrahams picture davidabrahams  路  3Comments

kailuowang picture kailuowang  路  3Comments