项目作者: anshulbajpai

项目描述 :
A journey to learn https://github.com/scalaz/scalaz-zio
高级语言: Scala
项目地址: git://github.com/anshulbajpai/learn-zio.git
创建时间: 2019-03-14T20:17:21Z
项目社区:https://github.com/anshulbajpai/learn-zio

开源协议:

下载


Learn-ZIO

This repo has code examples to understand the advantages of using ZIO library
by comparing with the code examples using other libraries and techniques

The order in which the code-examples should be read is given below:-

  1. usingVanillascala (using plain old scala with Futures and executing side-effects eagerly)
  2. usingMonads (using Monads and MonadTransformers with Futures and executing side-effects eagerly)
  3. usingIO (using IO and pushing side-effects to the boundary)
  4. usingFinaltagless (using final tagless technique complimented with mtl)
  5. usingZIO (using the ZIO library)

The above mentioned terms represents different packages under source code.

There is a fixed package which contains the Config case class and CurrencyAPI which every code example uses.

Every code-example contains a Program trait which depends on Algebra trait. The executable Application executes the program defined in the Program trait.

All the code examples are based on the following requirements

  1. Fetch all currencies from API
  2. Ask user from which currency they want to exchange
  3. Ask how much they want to exchange
  4. Ask to which currency they wants to exchange
  5. Fetch the current exchange rate
  6. Do the exchange
  7. Maintain transaction state for the user’s session
  8. Do necessary exception handling and logging (e.g. when user input is wrong, the API returns error or throws exception)