Skip to content

Instantly share code, notes, and snippets.

@alterationx10
Last active October 31, 2020 04:27
Show Gist options
  • Save alterationx10/67023029ae06c9354b0f8055e7753e07 to your computer and use it in GitHub Desktop.
Save alterationx10/67023029ae06c9354b0f8055e7753e07 to your computer and use it in GitHub Desktop.
object Gist
// A couple lines to help me remember the 5 ZIO shorthand types.
// Your Milage May Vary 😅
// Offical Links:
// https://zio.dev/docs/overview/overview_index
// https://www.zionomicon.com/
// IO can fail with E, or Succeed with A --- in any environment.
// IO is the only one that has an error channel that's not restricted to a Throwable.
type IO[+E, +A] = ZIO[Any, E, A]
// A Task can Throw, or Succeed with A --- in any environment
type Task[+A] = ZIO[Any, Throwable, A]
// From these:
// An R signifies a specific environmnent type, that can be thought of as providing a Resource.
// A U signinifes Unfailing, or Unexceptional - in the sense that there are no planned failure modes
// in the context of the effect that you should try to recover from, and any actual failure is a defect
// outside the scope of handling.
// A RIO can Throw, or Succeed with A --- in environment R
type RIO[-R, +A] = ZIO[R, Throwable, A]
// A UIO is an Unfailing IO
type UIO[+A] = ZIO[Any, Nothing, A]
// A URIO in an Unfailing IO --- in environment R
type URIO[-R, +A] = ZIO[R, Nothing, A]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment