1

CE 2.x. Monix 3.4. Line 1 compiles, line 2 gives a compilation error:

diverging implicit expansion for type cats.kernel.Order[A] starting with method catsKernelOrderForFunction0 in object Eq Stream.sleep_(5.seconds).compile.drain.as(ExitCode.Success) // 2

import cats.effect.{ExitCode, Timer}
import fs2.Stream
import monix.eval.{Task, TaskApp}
import scala.concurrent.duration.DurationInt


object ImplicitsFreeze extends TaskApp {

  def run(args: List[String]): Task[ExitCode] = {
    Stream.sleep_(5.seconds)(implicitly[Timer[Task]]).compile.drain.as(ExitCode.Success)  // 1
//    Stream.sleep_(5.seconds).compile.drain.as(ExitCode.Success) // 2
  }

}
Kamil Kloch
  • 333
  • 1
  • 9

1 Answers1

2

Adding annotation of the effect type solves the issue

Stream.sleep_[Task](5.seconds).compile.drain.as(ExitCode.Success) // 2
Kamil Kloch
  • 333
  • 1
  • 9