Skip to content

Instantly share code, notes, and snippets.

@dnaumenko
Created February 11, 2020 12:41
Show Gist options
  • Save dnaumenko/8359e6c77c65833687002336dc50406e to your computer and use it in GitHub Desktop.
Save dnaumenko/8359e6c77c65833687002336dc50406e to your computer and use it in GitHub Desktop.
import com.example.functional.env.catz._
def buildProgram[F[_] : Sync]: F[Unit] = {
import cats.implicits._
for {
_ <- Sync[F].delay(println("Starting"))
_ <- Sync[F].delay(println("Finished"))
} yield ()
}
implicit val provideEnv: ProvideEnv[Context[ExampleEnv]] = new ProvideEnv[Context[ExampleEnv]] {
override def provide: Context[ExampleEnv] = Context.initUnsafe(ExampleEnv("init"))
}
buildProgram[Env[ExampleEnv, ?]].unsafeRunSync(ExampleEnv("init"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment