Last active
April 2, 2023 19:06
-
-
Save dacr/47ca242e6d672e0154c5816a0330eea7 to your computer and use it in GitHub Desktop.
scala-cli issue with execution context / published by https://github.com/dacr/code-examples-manager #89b9cc9a-a797-4300-8448-dac276a9aa4a/8d7a052e95b5663005293dc1a739027411486404
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 : scala-cli issue with execution context | |
// keywords : scala, scala-cli, issues, @testable, @fail | |
// 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 : 89b9cc9a-a797-4300-8448-dac276a9aa4a | |
// created-on : 2022-01-09T16:51:53+01:00 | |
// managed-by : https://github.com/dacr/code-examples-manager | |
// run-with : scala-cli $file | |
// --------------------- | |
//> using scala "3.2.2" | |
// --------------------- | |
// snippet for scala-cli issue https://github.com/VirtusLab/scala-cli/issues/532 | |
// related issue : https://github.com/com-lihaoyi/Ammonite/issues/802 | |
// | |
// MORE UP TO DATE INFORMATION : https://github.com/VirtusLab/scala-cli/issues/1905 | |
// RELATED : https://github.com/VirtusLab/scala-cli/issues/1933 | |
import scala.concurrent.{Await, ExecutionContext, ExecutionContextExecutor, Future} | |
import scala.concurrent.duration.* | |
implicit val ec: ExecutionContextExecutor = ExecutionContext.global | |
val future = | |
for | |
message <- Future("Hello world") | |
_ <- Future(println(message)) | |
yield () | |
Await.ready(future, 5.second) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment