Skip to content

Instantly share code, notes, and snippets.

@susliko
Last active April 29, 2019 19:33
Show Gist options
  • Select an option

  • Save susliko/12a029a76543e75262e19f648fd0dc82 to your computer and use it in GitHub Desktop.

Select an option

Save susliko/12a029a76543e75262e19f648fd0dc82 to your computer and use it in GitHub Desktop.
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