Hi All,
I am trying to understand about this message, it is not very clear to me.
I have this small piece of code with cats-effect IO, and a simple implicit extension method.
The code works fine with CE 3.3.14, but fails as soon as I upgrade to 3.4.x with the error message:
import cats.effect._
object Implicits {
implicit class Xtensions (io: IO [_]) {
def debug: IO [_] = {
for {
res <- io
_ = println (">>> " + res)
} yield res
}
}
}
object TestApp extends IOApp.Simple {
import Implicits._
def run: IO[Unit] = {
val str = IO ("Hello World")
str.debug.void
}
}
missing argument list for method debug in class IO Unapplied methods are only converted to functions when a function type is expected. You can make this conversion explicit by writing
debug _
ordebug(_)(_)
instead ofdebug
.
I know that if I invoke the method as str.debug()
, then the issue solves.
But I am trying to understand what broke this. Only CE update is done, not other change. Scala version is 2.13.10.
Here is the link to scastie:
Could someone help me to understand more?
Thanks in advance