Last active
May 5, 2023 17:51
-
-
Save dacr/dc60e4fe02e2b4ef85d68cef934e8b6e to your computer and use it in GitHub Desktop.
ZIO learning - hello world using command line arguments / published by https://github.com/dacr/code-examples-manager #d8733706-94fb-439f-8397-bdef034736ea/7fbd64770c1985e61e213a23abb181f443fa8971
This file contains 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 - hello world using command line arguments | |
// keywords : scala, zio, learning, pure-functional, helloworld | |
// 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 : d8733706-94fb-439f-8397-bdef034736ea | |
// created-on : 2022-02-27T09:58:19.926769334Z | |
// managed-by : https://github.com/dacr/code-examples-manager | |
// run-with : scala-cli $file | |
// usage-example : scala-cli zio-learning-1-hello-5.sc -- john doe | |
// --------------------- | |
//> using scala "3.2.2" | |
//> using dep "dev.zio::zio:2.0.13" | |
// --------------------- | |
// ------------------------------------------------------------------------------ | |
// Inspired from Example coming from https://zio.dev/docs/getting_started.html | |
import zio.* | |
object HelloWorld extends ZIOAppDefault { | |
val appLogic = for { | |
args <- getArgs | |
_ <- Console.printLine(s"Hello, ${args.mkString(" ")}, welcome to ZIO!") | |
} yield () | |
def run = appLogic | |
} | |
HelloWorld.main(args) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment