Adding the cats dependency

The cats library provides abstractions for functional programming. Its name comes from the shortening of the phrase category theory. It is also a reference to the famous joke that managing developers is like herding cats—the truth is that you don't really have control—cats do whatever they want.

In this chapter, we are going to focus only on Validated and NonEmptyList, but cats offers many more powerful abstractions that we will explore later in this book.

First, edit built.sbt and add the following lines:

libraryDependencies += "org.typelevel" %% "cats-core" % "1.0.1"
scalacOptions += "-Ypartial-unification"

This brings the cats dependency to our project and also enables a compiler flag (partial unification) that is required by the library to infer types correctly.

Save the project with Ctrl + S. IntelliJ should offer to update the project to reflect the changes in the build file. Click on Refresh Project on top of built.sbt.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset