Do you want to write functions in a strict Functional Scala manner which is pure, total, and deterministic. Typeclass is the implementation for algebraic structure like Functor and Monad. Typeclass is similar to interface in Object Oriented (OO) programming. How does this feature benefits you?
Imagine one day you want to write functions in a strict Functional Scala manner which is pure, total, and deterministic. But how does that benefit you? For one, pure functions are both easy to reason and test which ultimately leads to improved code quality. Next, another equally important and interesting topic is Typeclass. Typeclass is the implementation for algebraic structure like Functor and Monad. Typeclass is similar to interface in Object Oriented (OO) programming, but it is a lot more powerful than what interface can do. Again, how does this feature benefits you?
In this talk, Teck Hooi will demonstrate writing pure functions using some common use cases and how to deal with the side effects. Next, he will implement Typeclasses using Monoid, Functor, and Monads as examples. Moving from there, he will show how library like Cats can be of great help and become a necessity in your project.
Reading Time: 4 minutes A blog on using higher-order functions in Scala.A higher-order function is a function that takes in another function as argument and itself returns some value or function. Some examples of higher-order functions include map, filter, reduce, foreach etc.
Reading Time: 5 minutes This post describes what to expect and how to start with Scala 3 Or Dotty. In this post, we will get a teaser of what changes to expect from Dotty as well as some of the new changes in the major release. At the end of the post, we will see how we can quickly start with the Dotty compiler and example code.
In this blog, we are going to see the use of Either in scala. We use Options in scala but why do we want to go for Either? Either is a better approach in the respect that if something fails we can track down the reason, which in Option None case is not possible. We simply pass None but what is the reason we got None instead of Some. We will see how to tackle this scenario using Either.
Scala: Map vs flatMap - While working with collections in Scala we frequently find ourselves using two most popular Functional combinators i.e, map() and its close
The fold method is a Higher Order Function in Scala and it has two variant namely, i. foldLeft ii. foldRight In this blog, we will look into them in detail and try to understand how they work. Before moving ahead, I want to clarify that the fold method is just a wrapper to foldLeft, i.e. the fold method internally invokes the foldLeft method. So, now let’s get started.