Functional Programming

Scala 3.0

Functional Programming: A Paradigm

It’s surprisingly hard to find a consistent definition of functional programming. But I think you can define FP with just two statements: 1. FP is about writing software applications using only pure functions. 2. When writing FP code you only use immutable values. Hence, Functional programming is a way of writing software applications using only pure functions and immutable values. Now, let us understand the Continue Reading


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


ScalaFP: Let’s Find The Reasons Behind Monads.

Monads in Functional Programming play an important role but they mostly confuse the beginners. One of the reasons for the confusion is that they mostly have a knowledge of imperative style programming, where they have no idea about function composition and its importance. In the terms of functional programming, the composition is the root where we have a set(Z) and we compose the elements of Continue Reading

Case Class Inheritance

Hello friends, as discussed in the previous blog we know what are case classes and what boilerplate code do they generate. Now in this blog, we will be discussing case class inheritance, how it can be achieved as the case to case inheritance is prohibited due to the equals and hashcode method case classes generate. We will also be telling the bad side of case classes. scala> Continue Reading

What is Uniform Access Principle?

Uniform Access Principle is a programming concept which was first introduced by Bertrand Meyer which stated that All services offered by a module should be available through a uniform notation, which does not betray whether they are implemented through storage or through computation. The principle simply means that the notation used to access a feature of a class shouldn’t differ depending on whether it’s an attribute or a Continue Reading

Case Class In Scala

Case Class is one of the great tool introduced by Scala in the functional programming world. case class Book(id: Int, title: String, isbn: Long) Let’s explore what’s hidden behind the above class. Case class is similar to a class but it provides a lot of boilerplate code for developers to use. By default, they are immutable i.e. once declared cannot be changed. If we compile Continue Reading


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: Mystery Of Scala Higher Kinded Type.

Scala type system holds a lot of mysteries. Sometimes these mysteries confuse us but mostly they provide us with a powerful feature. Today we will be discussing one of them called Higher Kinded Type Or Second Order Type. Before moving to higher kinded type lets brush up our basics first. Higher Order Function: So, functional programming follows an artistic rule called “functions are the first Continue Reading

Do you know Akka-HTTP Cache?

Today we are to going to talk about a very important aspect of reactive web applications development. It’s not from the alien world, we always talk about it but we rarely want to deal with it. It’s Cache. In today’s mammoth scalable architecture, we are mostly surrounded by big design issues and somewhere here and there we neglect benefits of using a very useful concept Continue Reading

Exploring Java 10 using Docker

On March 20, 2018, Java 10 was released and everybody wants to explore Java 10 but not everyone wants to change their development environment. So in this blog, we will be discussing how can we use Java 10 using Docker.

Back2Basics: Limit which classes a Trait can be mixed into!

A Scala trait is just like a Java interface. A trait can be extended by different classes, just the way we do with Java interfaces and also a class can inherit multiple traits, called mixins. To know more about basics of the trait, refer to this blog. But what if we want to restrict mixing of traits to a limited number of classes? Do we have 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

%d bloggers like this: