ZIO

November 25, 2018

Common type aliases

alias type
UIO[+A] ZIO[Any, Nothing, A]
Task[+A] ZIO[Any, Throwable, A]
RIO[-R, +A] ZIO[R, Throwable, A]
IO[+E, +A] ZIO[Any, E, A]

unsafeRun in ZIO 2.0.0

implicit class UnsafeRun(r: zio.Runtime[Any]) extends AnyVal:
  def unsafeRun[A](z: zio.ZIO[Any, Throwable, A]): A =
    zio.Unsafe.unsafe(r.unsafe.run(z).getOrThrowFiberFailure())

zio.Runtime.default.unsafeRun(
  zio.ZIO.attempt(println("Hello, world!"))
)

Examples

Basics

Scheduling

Forking

Interoperability

Experimental