Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions core/shared/src/main/scala/zio/ZIOApp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,22 @@ trait ZIOApp extends ZIOAppPlatformSpecific { self =>
}
object ZIOApp {

/**
* A class which can be extended by an object to convert a description of a
* ZIO application as a value into a runnable application.
*/
class Proxy(val app: ZIOApp) extends ZIOApp {
type Environment = app.Environment
override final def hook: RuntimeConfigAspect =
app.hook
final def layer: ZLayer[Has[ZIOAppArgs], Any, Environment] =
app.layer
override final def run: ZIO[Environment with ZEnv with Has[ZIOAppArgs], Any, Any] =
app.run
implicit final def tag: Tag[Environment] =
app.tag
}

/**
* Creates a [[ZIOApp]] from an effect, which can consume the arguments of the program, as well
* as a hook into the ZIO runtime configuration.
Expand Down