scala cats

Explore Id Monad in Cats

Reading Time: 3 minutes Today we are going to explore Id Monad in Cats. If you don’t know about Monad I’ll suggest you go through this blog and then read this for better understanding. What is Id Monad? According to the referenced book: Id is actually a type alias that turns an atomic type into a single-parameter type constructor. Ahan! So, did you understand something? Let me explain it Continue Reading

explore either in cats library

Explore Either in Cats Library

Reading Time: 4 minutes Hey everyone, I’m back with another blog in which we are going to explore Either in Cats Library. For an introduction to Either Monad in Cats and comparison between Either in standard Scala Library and Cats Library, you can have a look at my previous blog i.e Either in Cats vs Either in Scala. Also, if you don’t know what is a Monad you can Continue Reading

Diving into Scala Cats – Monoids

Reading Time: 2 minutes Today we are going to deep dive into the Scala Cats again to find out about Monoids. If you haven’t already read my post about Diving into Scala Cats – Semigroups I suggest you do so now. What are Monoids? The Monoid extends Semigroup and adds a default or fallback value for the given type. Monoid type class comes with two methods – one is the combine method of Semigroups, Continue Reading

A Quick Start to Cats Library

Reading Time: 3 minutes Hi everyone, recently I started exploring Cats library in Scala and so here I’m presenting you the first session on “Introduction to Cats”. It will give you a head start in Cats. Let me give you a brief description as well. What is Functional Programming? Functional programming (FP) is a style of software development emphasizing functions that don’t depend on program state. Functional code is Continue Reading

Understanding Monads: An Introduction

Reading Time: 3 minutes In Scala, we all have heard about Option, Future etc. I also heard that they are Monads. It was a new term to me so I googled it and the definitions I initially read were too confusing. Here is one of them : What is Monoid? What are Endofunctors? Looking into all these is so complex. So here, I’ll try to cover Monads in a Continue Reading

monads

ScalaFP: Firsthand With Scala-Cats Monads – #1

Reading Time: 4 minutes In the previous post, we had a look at the reasons behind the monads and how monads can help us design the programs in a functional style. Now we are going to explore some of the monads which are frequently used in the applications but not available within the Scala predefined libraries. We will be exploring the monads which are provided by the scala-cats functional Continue Reading

monads

ScalaFP: Welcome To The World Of Functors

Reading Time: 4 minutes In functional programming, we have various pillars like Functors, Monads, Applicative and more. Today we will try to explore one of these pillars called Functors. First let’s explore function composition: Function Composition:  In this diagram, we have 3 sets called A, B, and C. Set A contains an element called x. Suppose, we need to convert our Set A elements into Set C. But we have no Continue Reading

ScalaFP: Let’s discuss about Foldable

Reading Time: 3 minutes In our today’s blog, we are going to discuss a type of iterator called foldable that is used to iterate over collections. Foldable is an abstraction for the foldLeft & foldRight. We will now look in the Foldable. Foldable Foldable type class contains the foldLeft & foldRight are instances of foldable which we are used on List, Vector, and Stream. We can create generic folds with Continue Reading

ScalaFP: Understanding Monoids In Scala Pragmatically

Reading Time: 3 minutes As we discussed in our previous post, Monoids are semigroups meaning they have properties called closure and associative, along with identity element. So, now our question is, why do we require the identity element? Let’s add this one to our questions which were remaining from our previous post, : How can we use monoids with Scala? Where do we require Monoids? Now let’s answer these questions one Continue Reading

ScalaFP: Let’s Start with Implicit and Scala Cats

Reading Time: 3 minutes In our last blog, we have discussed the Type Class. You can find that blog Here: Type Class. Now we will discuss the Implicit in Scala. Implicit Implicit in Scala refers to either a value that can be passed “automatically”, so to speak or a conversion from one type to another that is made automatically. So we can create the implicit method with the help of Continue Reading

ScalaFP: Let’s Start with Type Class

Reading Time: 2 minutes Before we start talking about the Functional Programming with the Scala Cats, we should refresh our memory about the Type Class and Implicit. These are the base when we start learning the Scala Cats. Let’s start the discussion with the Type Class. Type Class A type class is an interface or API that represents some functionality, which we want to implement. Type class is programming Continue Reading