Functional Programming for Mortals (The Digital Book)
With Membership
Suggested price

Functional Programming for Mortals

with Scalaz

About the Book

This book is for the typical Scala developer, probably with a Java background, who is both sceptical and curious about the Functional Programming (FP) paradigm. This book justifies every concept with practical examples, including writing a web application.

Frequently Asked Questions

Q: How does it compare to the red book?

A: This book is blue.

Q: Where can I buy a physical copy?

A: Hardback books are available at Lulu (and budget Paperbacks too).

Q: Is this suitable for beginners?

A: No, this is an intermediate book. First read Programming in Scala or Essential Scala.

Q: I know Haskell, is this book for me?

A: You're not really the target audience. Also, I am so sorry.

Q: Why is the cover so ugly?

A: Because I love Geometrical Methods of Mathematical Physics.

About the Author

Sam Halliday
Sam Halliday

Chartered Mathematician, Haskell and Emacs hacker, Free Software / education zealot. Read an interview with Sam by Leanpub.

Sam Halliday

Episode 106

Table of Contents

  • About This Book
  • Copyleft Notice
  • Thanks
  • Practicalities
  • 1. Introduction
    • 1.1 Abstracting over Execution
    • 1.2 Pure Functional Programming
  • 2. For Comprehensions
    • 2.1 Syntax Sugar
    • 2.2 Unhappy path
    • 2.3 Gymnastics
    • 2.4 Incomprehensible
  • 3. Application Design
    • 3.1 Specification
    • 3.2 Interfaces / Algebras
    • 3.3 Business Logic
    • 3.4 Unit Tests
    • 3.5 Parallel
    • 3.6 Summary
  • 4. Data and Functionality
    • 4.1 Data
    • 4.2 Functionality
    • 4.3 Modelling OAuth2
    • 4.4 Summary
  • 5. Scalaz Typeclasses
    • 5.1 Agenda
    • 5.2 Appendable Things
    • 5.3 Objecty Things
    • 5.4 Mappable Things
    • 5.5 Variance
    • 5.6 Apply and Bind
    • 5.7 Applicative and Monad
    • 5.8 Divide and Conquer
    • 5.9 Plus
    • 5.10 Lone Wolves
    • 5.11 Co-things
    • 5.12 Bi-things
    • 5.13 Summary
  • 6. Scalaz Data Types
    • 6.1 Type Variance
    • 6.2 Evaluation
    • 6.3 Memoisation
    • 6.4 Tagging
    • 6.5 Natural Transformations
    • 6.6 Isomorphism
    • 6.7 Containers
    • 6.8 Collections
    • 6.9 Summary
  • 7. Advanced Monads
    • 7.1 Always in motion is the Future
    • 7.2 Effects and Side Effects
    • 7.3 Stack Safety
    • 7.4 Monad Transformer Library
    • 7.5 A Free Lunch
    • 7.6 Parallel
    • 7.7 IO
    • 7.8 Summary
  • 8. Typeclass Derivation
    • 8.1 Running Examples
    • 8.2 scalaz-deriving
    • 8.3 Magnolia
    • 8.4 Shapeless
    • 8.5 Performance
    • 8.6 Summary
  • 9. Wiring up the Application
    • 9.1 Overview
    • 9.2 Main
    • 9.3 Blaze
    • 9.4 Thank You
  • Typeclass Cheatsheet
  • Haskell
    • Data
    • Functions
    • Typeclasses
    • Records of Functions
    • Modules
    • Evaluation
    • Next Steps
  • Third Party Licenses
    • Scala License
    • Scalaz License

Causes Supported

Amazon Watch

Supporting Indigenous Peoples. Protecting the Amazon.

Amazon Watch is a nonprofit organization founded in 1996 to protect the rainforest and advance the rights of indigenous peoples in the Amazon Basin. We partner with indigenous and environmental organizations in campaigns for human rights, corporate accountability and the preservation of the Amazon's ecological systems.

We envision a world that honors and values cultural and biological diversity and the critical contribution of tropical rainforests to our planet's life support system. We believe that indigenous self-determination is paramount, and see that indigenous knowledge, cultures and traditional practices contribute greatly to sustainable and equitable stewardship of the Earth. We strive for a world in which governments, corporations and civil society respect the collective rights of indigenous peoples to free, prior and informed consent over any activity affecting their territories and resources. We commit, in the spirit of partnership and mutual respect, to support our indigenous allies in their efforts to protect life, land, and culture in accordance with their aspirations and needs.

The Leanpub 60-day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $12 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub