Understanding Kleisli: using it to pass context infoKleisli is a term that appears frequently when reading about functional programming. It is an important concept but it is not trivial to grasp. Often it is easier to understand new ideas by putting them into practice, in this blog entry we will see h...Nov 17, 2024 路 6 min readlrodero.hashnode.dev
Convert Future instances to cats-effect IOMuch (most?) of the third-parties software that you will have to deal with will not handle asynchronous actions using our beloved IO monad, they will instead use either Scala鈥檚 or Java鈥檚 Future. This brief entry shows how to convert those Futures int...Aug 15, 2024 路 2 min readlrodero.hashnode.dev
Micro library for retries in cats-effect using Scala extensionsThis blog entry will show how to add a simple retry mechanism to cats-effect (CE) using Scala 3 extensions. The idea is that whenever we define our IO instances we can also specify that, if they fail and certain conditions are met, they will be autom...Jun 2, 2024 路 6 min readlrodero.hashnode.dev
A more intuitive approach to the State Monad in ScalaThe 'Functional programming in Scala' book (aka 'the red book') defines a state transformation as a function with this signature: S => (S, A) where S is a type representing the state of our application and A is the type of the output we get running ...May 18, 2024 路 2 min readlrodero.hashnode.dev
The dining philosophers problem with Scala 3 and Cats EffectThe dining philosophers problem is a classical concurrency problem. This post shows an example of how you can use Scala 3 and the Cats Effect (CE) libraryto implement a solution of that problem. 馃挕 All code samples can be compiled using scala-cli. T...Mar 24, 2024 路 6 min readlrodero.hashnode.dev