Last active
May 6, 2023 15:40
-
-
Save dacr/1d407339f8f5fb214da0d703a73d0d52 to your computer and use it in GitHub Desktop.
ZIO learning - zio aspects / published by https://github.com/dacr/code-examples-manager #ca811a16-7fe8-4290-9243-bc41fe58351a/8762b5e5508a597fd32ac15bc8ebdba5416c01fa
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 - zio aspects | |
// keywords : scala, scalacli, zio, aspect, @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 : ca811a16-7fe8-4290-9243-bc41fe58351a | |
// created-on : 2021-11-14T08:36:25+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" | |
// --------------------- | |
import zio.* | |
object Encapsulated extends ZIOAppDefault { | |
def run = for { | |
result1 <- ZIO.attempt(42) @@ ZIOAspect.logged("op1") | |
result2 <- ZIO.succeed("oups") @@ ZIOAspect.logged("op2") | |
} yield (result1, result2) | |
} | |
Encapsulated.main(Array.empty) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment