Skip to content

Instantly share code, notes, and snippets.

@dacr
Last active May 6, 2023 15:40
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 dacr/9eb2e8d3b624e4ffe6a3115bbae5d084 to your computer and use it in GitHub Desktop.
Save dacr/9eb2e8d3b624e4ffe6a3115bbae5d084 to your computer and use it in GitHub Desktop.
ZIO learning - program with a return Int value / published by https://github.com/dacr/code-examples-manager #ab6b2621-56ae-490d-bdde-3210ff38ce38/a2c39de1788d899206d5af6c2e04d0a9ba3afb08
// summary : ZIO learning - program with a return Int value
// keywords : scala, zio, learning, pure-functional, @testable
// publish : gist
// authors : David Crosson
// license : Apache NON-AI License Version 2.0 (https://raw.githubusercontent.com/non-ai-licenses/non-ai-licenses/main/NON-AI-APACHE2)
// id : ab6b2621-56ae-490d-bdde-3210ff38ce38
// created-on : 2021-03-27T08:57:03+01:00
// managed-by : https://github.com/dacr/code-examples-manager
// run-with : scala-cli $file
// ---------------------
//> using scala "3.2.2"
//> using dep "dev.zio::zio:2.0.13"
//> using dep "fr.janalyse::zio-worksheet:2.0.13.0"
// ---------------------
import zio.*, zio.ZIO.*, zio.worksheet.*
val myAppLogic = for {
a <- succeed(10)
b <- succeed(20)
c <- succeed(a + b + 12)
} yield c
// -------------------------------------------------------------
val result = myAppLogic.unsafeRun
println(s"result=$result")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment