You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is based on ZIO 2.0.X (in particular 2.0.10).
For simplicity, ZIO environment has been omitted but all the functions also work with the form ZIO[R, E, A].
Function arguments are usually by name, but that has (mostly) been ignored for simplicity. Also, functions are often "more generic" in their parameter types than shown below.
For many functions there are several (unmentioned) related functions that are conceptually similar but differ in some detail. They are usually easy to learn due to consistent naming.
Important ZIO types other than the functional effect type ZIO[R, E, A] have been left out. For example: ZStream[R, E, A], ZLayer[RIn, E, ROut], Fiber[E, A] and Ref[A].
In the remainder of this cheat sheet, E1 >: E, but E2 can be any error type. Also A1 >: A.
Aliases
Alias
Full Form
UIO[A]
ZIO[Any, Nothing, A]
IO[E, A]
ZIO[Any, E, A]
Task[A]
ZIO[Any, Throwable, A]
RIO[R, A]
ZIO[R, Throwable, A]
URIO[R, A]
ZIO[R, Nothing, A]
Creating effects
Name
Given
To
ZIO.succeed
=> A
IO[Nothing, A]
ZIO.fail
=> E
IO[E, Nothing]
ZIO.interrupt
IO[Nothing, Nothing]
ZIO.die
Throwable
IO[Nothing, Nothing]
ZIO.attempt
=> A
IO[Throwable, A]
ZIO.async
((IO[E, A] => Unit) => Unit) FiberId
IO[E, A]
ZIO.fromEither
Either[E, A]
IO[E, A]
ZIO.left
A
IO[Nothing, Either[A, Nothing]]
ZIO.right
B
IO[Nothing, Either[Nothing, B]]
ZIO.fromFiber
Fiber[E, A]
IO[E, A]
ZIO.fromFuture
ExecutionContext => Future[A]
IO[Throwable, A]
ZIO.fromOption
Option[A]
IO[Option[Nothing], A]
ZIO.none
IO[Nothing, Option[Nothing]]
ZIO.some
A
IO[Nothing, Option[A]]
ZIO.fromTry
Try[A]
IO[Throwable, A]
ZIO.acquireReleaseWith
IO[E, A] (acquire) A => IO[Nothing, Any] (release) A => IO[E, B] (use)