cats effect

future to IO

Why use Cats IO instead of Scala Futures?

Reading Time: 2 minutes This article focuses on using Cats-Effects IO. Cats effects can be applied to other IO libraries as well such as Monix. We are discussing Future to IO conversion in this blog. Main benefits of using IO: IO is pure, immutable and referentially transparent. It makes it easy to control the execution of the effects. It’s currently the most common solution to reflect the pure and impure Continue Reading

Fibers: The Fundamental Abstraction in Cats Effect 3

Reading Time: 2 minutes Fibers are the fundamental abstraction in Cats Effect, similar to threads, they represent a sequence of actions which will ultimately be evaluated in that order by the underlying hardware. Fibers are very lightweight. Since fibers diverge from threads is in their footprint and level of abstraction. In thread each step is a statement, and defined in sequence by writing them in particular order within a Continue Reading

Cats Effect : Pure Functional way to code in Scala

Reading Time: 2 minutes Follow 5 Simple Rules with Cats Program written using Cats Effect provides incredibly strong guarantees and powerful functionality, performance, safety, and composability, provided you follow each of the following rules: Wrap all side-effects in delay, async, blocking, or interruptible (pro tip: try to keep the size of your delay blocks small; two delays with a flatMap is much better than one big delay) Use bracket or Resource for anything which must be closed Never hard-block a thread outside of blocking or interruptible Use IOApp instead of writing your own def main Continue Reading