Skip to content

Instantly share code, notes, and snippets.

@alexandru
Last active September 4, 2018 07:15
Show Gist options
  • Save alexandru/e45231fddb42c77c830695aadaf6dbb9 to your computer and use it in GitHub Desktop.
Save alexandru/e45231fddb42c77c830695aadaf6dbb9 to your computer and use it in GitHub Desktop.
import IOApp.Runtime
trait IOApp {
// Implicit extractor
implicit final def contextShift(implicit r: Runtime): ContextShift[IO] =
r.contextShift
// Implicit extractor
implicit final def timer(implicit r: Runtime): Timer[IO] =
r.timer
def run(args: List[String])(implicit r: Runtime): IO[ExitCode]
// ...
}
object IOApp {
trait Runtime {
def executionContext: ExecutionContext
def timer: Timer[IO]
def contextShift: ContextShift[IO]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment