Functional Programming with Scala Cats

A journey into the world of typeclasses, the Cats library, and the functional way of doing things in Scala

Ratings: 4.75 / 5.00




Description

When we start our journey as a Scala developer, our first impression of the language may be that of 'a better Java'. We learn about classes, traits, pattern matching and some other constructs that make our life easier. At some point we come across the amazing higher-order methods such as map, filter and fold. These serve as a great first taste of functional programming.

But what if I told you that there is much more than that? In this course I will show you how standard functional programming practices can help you write code that is more generic, robust and testable.

This course is divided into 3 main sections.

In the first section, we will learn about typeclasses. We will use as a driving example the problem of encoding and decoding objects into and from bytes. By the end of this section you will be able to create your own typeclasses and use the typeclass pattern to write polymorphic code.

In the second section, we will take a look at some of the most common typeclasses in functional programming, including Monads, Applicatives, Functors and many more. We will use the famous Cats library to provide us with their implementations, and we will use Discipline along with ScalaCheck and ScalaTest to test their laws. By the end of this section, you will be able to write lawful instances of these typeclasses for any of your types, and test their validity in an automated manner.

In the third and final section, we will learn to perform many common programming tasks with functional structures. These tasks include:
- Validations via the Validated datatype

- Dependency injection with the Reader monad

- Tracking data in our computations with the Writer monad

- Managing state with the State monad

- Writing stack safe computations with Trampolines

- Making computations lazy with the Eval monad

- Composing monad stacks via monad transformers such as ReaderT and OptionT

- Suspending effects with a simple but useful implementation of the IO monad

I'm a big believer of learning by doing so I've included a lot of in-video exercises, along with quizzes and assignments at the end of each section. I hope you enjoy doing them as much as I enjoyed putting them together!

Without further ado, I want to give you a big welcome to the course and the thrilling world of functional programming!

What You Will Learn!

  • Create own typeclasses
  • Write and use lawful instances of well-known typeclasses such as Functors, Applicatives, Monads, etc.
  • Perform common programming tasks (validation, dependency injection, state management, etc.) in a functional way.

Who Should Attend!

  • Scala developers with 1 or 2 years of experience who want to learn the functional side of the language
  • Students who have completed an introductory Scala course and are willing to learn more advanced features