u/kubukozin r/scala • Recommends
Resource composition in cats-effect with the Resource data type - Scala tutorial
#cats-effect#resource#taglessfinal
3.7K subscribers • 30 videos on Hallway
Intermediate. Assumes working knowledge.
5K views7 years ago1 recommendation
Programming languagesSoftware designScalaFunctional programming
A tutorial explaining how to compose dependent resources in Scala using the Resource data type from cats-effect.
In this video, you'll see how you can build resources that depend on each other in cats-effect, using the Resource type! We'll look at what Resource is, how to build an instance of it, and how to run a long-running program started with Resource, like a HTTP server. - Intro, recap of `bracket` - problem description - naive implementation with `bracket` - introduction of the `Files` algebra - introduction of Resource - improved solution with Resource - using a Resource - solution cleanup, `fromAutoCloseable`, moving Blocker to the for comprehension - overview of the order of resource acquisition/cleanup at the point of `use` - introducing our Tagless Final algebra - simulating long-running applications - Async.never, IO[Nothing] - constructing Tagless Final algebra instances inside Resource - running the application using `Resource.use` - parting words Previous videos: Bracket - youtube.com/watch?v=vsJz-fdEsd4 Blocker - youtube.com/watch?v=v__IRT-QkwY If you want to learn more about Resource, see the Cats Effect docs: typelevel.org/cats-effect/datatypes/resource.html Read the code: github.com/kubukoz/videos/tree/master/resource Cats-effect: github.com/typelevel/cats-effect Follow me on Twitter: twitter.com/kubukoz Read my blog: blog.kubukoz.com Let me know if you liked this video, and whether you'd like to see any other functional programming topics here.u/kubukozin r/scala • Recommends