Book Image

Professional Scala

By : Mads Hartmann, Ruslan Shevchenko
Book Image

Professional Scala

By: Mads Hartmann, Ruslan Shevchenko

Overview of this book

This book teaches you how to build and contribute to Scala programs, recognizing common patterns and techniques used with the language. You’ll learn how to write concise, functional code with Scala. After an introduction to core concepts, syntax, and writing example applications with scalac, you’ll learn about the Scala Collections API and how the language handles type safety via static types out-of-the-box. You’ll then learn about advanced functional programming patterns, and how you can write your own Domain Specific Languages (DSLs). By the end of the book, you’ll be equipped with the skills you need to successfully build smart, efficient applications in Scala that can be compiled to the JVM.
Table of Contents (12 chapters)

Chapter 7. Functional Idioms

In the previous chapter, we covered implicit parameters and implicit conversions. We saw how to enable elegant extension methods for your code. We also had a look at how the Scala compiler resolves implicits. Finally, we covered how implicits work, how to use them, and what kind of benefits they provide.

In this chapter, we'll cover the core concepts of functional programming like Pure functions, immutability, and higher-order functions. We'll build upon this understanding and introduce some of the design patterns that are prevalent in large functional programs that you'll no doubt run into once you start to use Scala libraries that focus on functional programming. Finally, we'll cover two popular functional programming libraries called Cats and Doobie, and use them to write some interesting programs.

Functional programming languages have been around for a very long time, but they have gotten more traction lately, with functional programming concepts being...