Skip to content

Instantly share code, notes, and snippets.

@martinlechner1
Created May 5, 2020 13:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martinlechner1/8f8f48c55cf8ca8a9bd86f0839b5ac59 to your computer and use it in GitHub Desktop.
Save martinlechner1/8f8f48c55cf8ca8a9bd86f0839b5ac59 to your computer and use it in GitHub Desktop.
# ZIO usage
## ZLayer for dependency management
- Type safe
- Composable
- No Magic / No reflection (unlike Guice)
- Support for modeling failing dependencies (such as config loading)
## Module pattern
## ZIO as effect system
- Modeling concurrency in a lazy evaluated approach
- This allows the effect system to optimize operations -> high performance
- Main appeal for business logic: Bifunctor IO: `IO[E, A]`
- Typesafe way of handling business errors
- A lot of useful stuff for concurrency
## Vs Future
- Referential Transparency => easier to reason about code
- Better performance (=> Lower costs)
## Vs Cats-Effect
- Similar to IO would be EitherT[IO, E, A]
- ZIO is more a framework and less, cats-effect a library
## Some cool things
### Retries
`.retry(Schedule.recurs(5).delayed[Clock](_ + 100.milliseconds)`
### Parallel processing
`.collectAllPar`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment