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/1d407339f8f5fb214da0d703a73d0d52 to your computer and use it in GitHub Desktop.
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
// 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