ZIO 是一个零依赖的 Scala 库,用于异步并发编程。
主要特性:
示例代码:
import zio.App import zio.console._ object MyApp extends App { def run(args: List[String]) = myAppLogic.fold(_ => 1, _ => 0) val myAppLogic = for { _ <- putStrLn("Hello! What is your name?") name <- getStrLn _ <- putStrLn(s"Hello, ${name}, welcome to ZIO!") } yield () }