Composable Resource Management in Scala

Written by bszwej | Published 2020/04/28
Tech Story Tags: scala | functional-programming | database | message-queue | programming | programming-languages | monads | functors

TLDR 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.via the TL;DR App

no story

Written by bszwej | Software Engineer @MOIAmobility. Scala and Functional Programming enthusiast.
Published by HackerNoon on 2020/04/28