Exit e-book
Show all chapters
A sneak peek into the ZIO of the (near) future
A sneak peek into the ZIO of the (near) future
Mastering Modularity in ZIO with Zlayer

A sneak peek into the ZIO of the (near) future

In the previous sections we have seen how to write the Tic-Tac-Toe application with ZLayers, using ZIO 1.0.10, the latest stable release of ZIO at the time of writing. In this section we’ll take a sneak peek into the ZIO of the (near) future. We’ll be able to do this because ZIO 2.0.0-M1 has just been released, so we can have a taste of what’s waiting for us in ZIO 2.0!

ZIO 2.0 will bring several improvements (some of them already available in ZIO 2.0.0-M1):

  • New runtime.
  • New fiber-aware scheduler.
  • Optimized handling of blocking operations.
  • Highly performant streams.
  • Better error messages.
  • Fewer imports.
  • Better naming. For instance:
    • Instead of console.putStr we now have Console.print
    • Instead of console.putStrLn we now have Console.printLine
    • Instead of console.getStrLn we now have Console.readLine
  • New smart constructors for ZIO, ZManaged and ZStream. For example, instead of having to use ZIO.fromOption, ZIO.fromTry, ZIO.fromEither or ZIO.fromFuture you can just use ZIO.from, which accepts Option[A], Try[A], Either[E, A] or Future[A] as parameters!
  • Built-in logging and metrics.
  • Optimized execution tracing.


As for ZLayers, the big news is that the functionality of the ZIO Magic library will be included out of the box in ZIO 2.0! So, we won’t need ZIO Magic anymore, and we can already use the following methods in ZIO 2.0.0-M1:

  • ZIO#inject
  • ZIO#injectCustom
  • ZLayer.wire
  • ZLayer.wireSome

The following methods are not available in ZIO 2.0.0-M1 yet, but they will be available in future releases (and you can still use ZIO magic in the meantime):

  • ZLayer.wireDebug
  • ZLayer.wireSomeDebug

If you want to check out how the code of our Tic-Tac-Toe application looks with ZIO 2.0.0-M1, you can see it in the 2.x branch of  jorge-vasquez-2301/zio-zlayer-tictactoe repository.