Functional Programming In Scala

Composing and Chaining Effects together in ZIO

Reading Time: 3 minutes Introduction to ZIO ZIO is a library for asynchronous and concurrent programming that is based on pure functional programming. It combined with Scala help us to develop applications that are purely functional, asynchronous, type-safe, resilient, and testable. At the core of ZIO is ZIO data type which is defined as: ZIO is lazy! The difference between ZIO and procedural programming is quite straightforward. In the Continue Reading

Let’s learn about function composition in Scala

Reading Time: 3 minutes In this blog, we are going to learn about how a list of functions can be composed to create a single function, in the context of mapping a set of values using those functions. Introduction When we compose two functions, we create a new function which applies one function to the result of the other. If I have one function a -> b which takes an a and gives Continue Reading

Introduction To Functional Programming With Scala

Reading Time: 3 minutes 1. Overview Of Functional With Scala In this blog, we will learn about functional programming concepts with Scala as a programming language. 2. What is Functional Programming? Functional programming is a programming paradigm that uses functions as the central building block of programs. In functional programming, we strive to use pure functions and immutable values. First of all, each function must be a pure function. But what does Continue Reading

Pattern Matching: The Most Powerful Tool of Functional Programming

Reading Time: 2 minutes Hi, community, in this blog, we will be covering what is pattern matching, when should we use it, and at the end, we’ll compare it with if-else. What is Pattern Matching? Pattern Matching is one of the most powerful tools in Scala. It’s similar to a switch statement in java but with loads of functionalities in comparison to a switch statement. Definition Pattern Matching is Continue Reading

Error Handling in Scala with Option, Try/Catch and Either

Reading Time: 3 minutes Error handling is the process of handling the possibility of failure. For example, failing to read a file and then continuing to use that bad input would clearly be problematic. Noticing and explicitly managing these errors saves the rest of the program from various pitfalls. Exceptions in Scala work the same way as in C++ or Java. When an exception occurs, say an Arithmetic Exception then the Continue Reading

A Simple Introduction to Higher Order Functions in Scala

Reading Time: 4 minutes Overview In this blog, we’ll understand the concept of higher order function in Scala. Also, we’ll learn about some of the most commonly used higher order functions in Scala. Higher Order Function A function is said to be a Higher Order Function if it can take another function as an argument or returns a function as its result. This is possible because of the fact Continue Reading

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

Either in Cats vs Either in Scala

Reading Time: 4 minutes Hola amigos! Last time I discussed Monads in general and in Cats as well. In this blog, let’s have a look at one of the most known monad Either. I’ll be giving an introduction to it and also there will be a comparison between two i.e Either in Cats vs Either in Scala. What is Either? Either basically represents a value of one of two 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