Last active
May 25, 2024 08:38
-
-
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/6043e17c2c2a81b8156e61f14ee09a7b86335e9b
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 : 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.4.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