Last active
February 3, 2026 20:20
-
-
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/776b3570ee767490574ef56a1bd2657bd9440393
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 - zio aspects | |
| // keywords : scala, scalacli, zio, aspect, @testable | |
| // publish : gist | |
| // authors : David Crosson | |
| // license : Apache License Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) | |
| // 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.4.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