Composable Resource Management in Scala
Too Long; Didn't Read
This article is dedicated to beginner and intermediate level Scala programmers. The idea is to encapsulate resource management inside a function and delegate its usage to a closure (handle) In other words, to loan the resource to the handler. We’ll start with the most basic ones and iteratively improve to achieve a fully compositional and safe way of dealing with them. We can use the so-called Loaner pattern to better manage resources in purely functional programs with Cats Effect 2xx.