cats icon indicating copy to clipboard operation
cats copied to clipboard

EitherT leftWiden not available for Nothing error type

Open Adriani-Furtado opened this issue 5 years ago • 2 comments

It seems leftWiden is not available for EitherT with type Nothing as the error. A proposal was to add leftWiden directly into EitherT instead of having it be implicit

EitherT(cats.effect.IO(Either.right[Nothing, Int](1))).leftWiden[String]

results in the following message:

type arguments [String] do not conform to method leftWiden's type parameter bounds [AA >: A]
val res7 = EitherT(cats.effect.IO(Either.right[Nothing, Int](1))).leftWiden[String]

Adriani-Furtado avatar Apr 26 '20 15:04 Adriani-Furtado

I'm 👍 for having that in EitherT, but the problem touches all types with polymorphic errors. If I'm not too mistaken, it should be possible to special-case Nothing and add another implicit extension that only works if the error is of type Nothing.

kubukoz avatar May 02 '20 11:05 kubukoz

But that's a very general problem with scalac and implicits not resolving for Nothing. The question is if Cats should add specialized instances for Nothing. I couldn't find any precedent for that.

joroKr21 avatar May 07 '20 18:05 joroKr21