Last active
April 29, 2019 19:33
-
-
Save susliko/12a029a76543e75262e19f648fd0dc82 to your computer and use it in GitHub Desktop.
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
| import java.util.concurrent.Executors | |
| import scala.concurrent.ExecutionContext | |
| import cats.effect._ | |
| object Foo extends IOApp { | |
| val cs = implicitly[ContextShift[IO]] | |
| val ex = Executors.newCachedThreadPool() | |
| val ec = ExecutionContext.fromExecutor(ex) | |
| def run(args: List[String]) = | |
| for { | |
| _ <- cs.evalOn(ec)(IO(println("foo"))) | |
| _ = ex.shutdown() | |
| } yield ExitCode.Success | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment