Created
February 11, 2020 12:41
-
-
Save dnaumenko/9bb36045ad75856046b52e8bb4b29622 to your computer and use it in GitHub Desktop.
This file contains 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 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