Last active
May 25, 2024 10:18
-
-
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/5522a3a39290fc73d7dcaa17c5b389fc2487e41b
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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.4.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