Created
February 11, 2020 12:41
-
-
Save dnaumenko/8359e6c77c65833687002336dc50406e 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