kitlangton/zio-magic

"Contains non-Has types:" is fired when the type is a `Has`

Opened this issue · 5 comments

Hi,

Please see:

https://scastie.scala-lang.org/rHC7cDL5RjSb0XSvzzjR4A

same code:

import zio._
import zio.magic._

class Setup[Deps <: Has[_]] {
  val layer: URLayer[Deps, Has[String]] =
    ZLayer.wireSome[Deps, Has[String]](ZLayer.succeed(""))
}

I expect this code to compile, but it says Deps is not a Has which clearly is.

Thank you

I didn't test with zio 2.0

Ah yeah, this is fixed with ZIO 2.0 (well, especially because we've obviated Has). zio-magic for 1.0 is not great at dealing with type parameters.

perhaps is fixable, until we get to use zio 2 we're still stuck with zio-magic.

Is ZIO 2 an option, perchance? I've not really worked on this for a while. The version of zio-magic in ZIO 2 is way, way shinier :)