Closed fillson-shady closed 4 years ago
0.10.2
will support Has
, (will need a new macro, as TraitConstructor won't handle it) working on it...
Fixed in https://github.com/7mind/izumi/pull/960
@fillson-shady You can now use
make[X].fromHas(zioEnvCtor)
make[X].fromHas(zmanagedEnvCtor)
make[X].fromHas(zlayerEnvCtor)
def zioEnvCtor: URIO[Has[Dep1] with Has[Dep2],X]
def zmanagedEnvCtor: URManaged[Has[Dep1] with Has[Dep2],X]
def zlayerEnvCtor: URLayer[Has[Dep1] with Has[Dep2],X]
Uniformly for all ZIO, ZManaged and ZLayer types (or other types that implement BIOLocal
),
without writing provideCake
You can also use environment and parameter dependencies at the same time in one constructor:
make[X].fromHas(zioArgEnvCtor _)
def zioArgEnvCtor(a: Arg1, b: Arg): RIO[Has[Dep1], X]
Hello! I have difficulties with running Distage hello world example on zio:1.0.0-RC18. First problem is that support for
ZLayer
is probably missing. This code does not complies:As a workaround you can convert a ZLayer into a ZManaged:
Another (blocker for me) problem is inability to use the
TraitConstructor
:That gives you the compile time error:
Of course you can provide this dependency by hand:
But in real application there will be much more complex dependency graph, so the code from above is not a good solution.
Is there any possibility to solve these issues?