rssh / dotty-cps-async

experimental CPS transformer for dotty
Apache License 2.0
178 stars 22 forks source link

analyzer reports unused variable of type CpsMonad as Monadic Variable #62

Closed rssh closed 1 year ago

rssh commented 1 year ago

Look at https://github.com/typelevel/cats-effect-cps/pull/98

      val program = async[IO]{
        async[OptionTIO](optionT.await).value.await
      }

Here internal async before macro: before transformed:

 {
  val x$2$proxy18 = catsEffectCpsConcurrentMonad[[A] => OptionT[IO, A]](kernel.Async.asyncForOptionT[IO](IO.asyncForIO))
  await[[A] => OptionT[IO, A], scala.Int, [A] => OptionT[IO, A]](optionT)(x$2$proxy18, evidence$29)
}

After transformation become

transformed value: {
  val cpsMonad = catsEffectCpsConcurrentMonad[[A] => OptionT[[A] => IO[A], A]](kernel.Async.asyncForOptionT[IO](IO.asyncForIO))
  cpsMonad.flatDelay[scala.Int]({
    val x$2$proxy18 = catsEffectCpsConcurrentMonad[[A] => OptionT[cats.effect.IO, A]](kernel.Async.asyncForOptionT[IO](IO.asyncForIO))
    optionT
  })
}

And we see that x$2proxy18. is not used and issue warning about this.

Probems: 1: we should catch for this morning F[_], not CpsMonad[F] 2: are we need keep non-used value ?