scala cats

monads

ScalaFP: Firsthand With Scala-Cats Monads – #1

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

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

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

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

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

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

ScalaFP: Understanding Semigroups In Scala Pragmatically

In our previous post, we discussed semigroups according to mathematics and we conclude that semigroups have two properties called closure and associativity. But still, we have some questions like: How can we use semigroups by using Scala? Where do we require to use semigroups? First, let’s try to figure out, when and where we require semigroups in our code and during this we will automatically Continue Reading

%d bloggers like this: