Ammonite icon indicating copy to clipboard operation
Ammonite copied to clipboard

Ammonite bizarrely hangs on top level function when combined with cats-effect

Open clintonmead opened this issue 3 years ago • 1 comments

I'm getting a very bizarre issue combining Ammonite 3 with cats-effect. The following script hangs between printing "1" and "2":

#!/usr/bin/env amm

import $ivy.`org.typelevel::cats-effect:3.1.1`
import cats.effect.IO
import cats.effect.unsafe.IORuntime

def g() : IO[Unit] = IO(())

object HelloWorld {
  def f() : IO[Unit] = IO(())

  val blah : IO[Unit] = for {
    x <- f()
    _ <- IO(println("1"))
    y <- g()
    _ <- IO(println("2"))
  } yield ()
}

HelloWorld.blah.unsafeRunSync()(IORuntime.global)

It seems as though it hangs on call to the top level function g() but not the member function f().

clintonmead avatar Jul 06 '21 13:07 clintonmead

idk, but perhaps the root cause is similar to the notorious https://github.com/scala/bug/issues/9076

SethTisue avatar Jul 08 '21 01:07 SethTisue