scala cats

Functors in Functional Programming

Functors in Functional Programming

Reading Time: 5 minutes 1. Overview In this tutorial, we’ll take a look at Functor type class in Cats. The idea of Functor is “something that can be mapped over”, we’ll see what is actually mapped and how. In functional programming, Functors come into play when we have types or values wrapped inside contexts or containers. We don’t have to know any of the implementation details of those contexts Continue Reading

Scala Cats - Functors

Diving into Scala Cats – Functors

Reading Time: 4 minutes If you’re new to the concept of type classes I suggest you read my other article explaining them. The Cats library makes extensive use of type classes and a basic understanding is a prerequisite for this article. In previous articles, we talked about Semigroups and Monoids, which are abstractions that let us combine values of the same type together. In this post, we’ll take a look at Functors, which Continue Reading

explore either in cats library

Exploring Eval Monad in Cats

Reading Time: 4 minutes While exploring Cats I learned about Monads and its different instances available for use and now I’m here sharing all of that with you all. 😊 In today’s blog, we will be exploring Eval Monad in Cats. Model of Evaluation From the model of evaluation, I am referring to the way that the value will be evaluated. Generally, we have two of them i.e. Eager Continue Reading

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

Scala Cats - Functors

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

Scala Cats - Functors

Getting Started with Scala Cats

Reading Time: 3 minutes Introduction This article is about Scala Cats. It is a library which provides abstraction for functional programming in the Scala programming language. The name is a playful shortening of the word category. Cats is a lightweight, modular, and extensible library for functional programming. Cats contains a wide variety of functional programming tools and allows developers to pick the required ones. The majority of these tools 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