1. Home
  2. Books
  3. Functional Programming in Scala
Functional Programming in Scala

Ch. 1free to read

Functional Programming in Scala

Paul Chiusano, Rúnar Bjarnason

66 min8 chapters

What It’s About

The type signature is a contract that tells you everything a function can and cannot do before you read a single line. This book shows that by removing one constraint (side effects), you can write everything else better. Error handling, parallelism, and I/O all have cleaner solutions. The payoff is code you can understand entirely on its own, without holding the entire system in your head.

Read a Sample

Functional Programming in Scala: Summary

In 1969 a three-hundred-page novel came out in Paris. In it a man vanishes, his friends go looking for him, and the trail leads nowhere. The critics liked it. One reviewer praised the prose at length and never once noticed what was odd about the text.

There is not a single letter "e" in it. In French, a language where roughly every seventh letter is an "e". Georges Perec chose to give up the most common letter in his own language and then wrote the novel out of what was left. The text was not any poorer for it. The missing letter pushed him toward solutions he'd never have found otherwise.

Paul Chiusano and Rúnar Bjarnason offer exactly this kind of bet, except the constraint isn't on letters but on code. They forbid one single thing: your functions may not do anything behind your back. They can't write to a file, throw an error, overwrite a variable or touch the screen. They can't do anything at all except compute a result from their input. When you first hear it, this sounds less like a constraint and more like an amputation.

And yet. Over several hundred pages the book shows that you can still write everything this way: error handling, state, concurrency, files, the screen. Each one has a clean solution, and most of those solutions are better than what they replace.

Read It in 66 Minutes

This book and 532 others are waiting for you in BookBase.

Scan with your phone