The Science of Functional Programming

The book is a giant tutorial that covers both the theory and the practice of functional programming, with the goal of building theoretical foundations that are valuable to practitioners.

Brief table of contents, as of now (starred chapters may be removed or their intended material rearranged):

Chapter 1. Mathematical formulas as code. I. Nameless functions

Chapter 2. Mathematical formulas as code. II. Mathematical induction

Chapter 3. The logic of types. I. Disjunctive types.

Chapter 4. The logic of types. II. Higher-order functions.

Chapter 5. The logic of types. III. The Curry-Howard correspondence.

Chapter 6. Functors and contrafunctors.

Chapter 7. Typeclasses and functions of types.

Chapter 8. Computations in functor blocks. I. Filterable functors.

Chapter 9. Computations in functor blocks. II. Semimonads and monads.

Chapter 10. Applicative functors and contrafunctors.

Chapter 11. Traversable functors and profunctors.

Chapter 12. "Free" type constructions.

Chapter 13. Computations in functor blocks. III. Monad transformers.

Chapter 14. Summary and outlook.

Chapter 15. Essay: Software engineers and software artisans.

Chapter 16. Essay: Towards functional data engineering with Scala.

Chapter 17. Applied functional type theory: a proposal.

Appendix A. Notations.

Appendix B. Glossary of terms.

The Science of Functional Programming: A tutorial, with examples in Scala is a free textbook in progress. Work on this book started in 2017 in the form of a series of Youtube tutorials on functional programming. The first tutorial is available as https://www.youtube.com/watch?v=0Ld79Lnzx_o and the entire series as the playlist https://www.youtube.com/watch?v=0Ld79Lnzx_o&list=PLcoadSpY7rHXJWbUkjQ3P9MXBbXxLP8kV

In 2019, I started to write up the text of the book. See https://www.youtube.com/watch?v=tgr_dV7_53s for a presentation explaining some of the main themes of the book.

The book is to be published by lulu.com (ISBN 978-0-359-76877-6) as a free online book (2019) under GNU Free Documentation License (FDL).

The full source files for the textbook are tracked at github.com/winitzki/sofp

The current PDF build is found in the "Releases" section of that repository, under "Assets".

Current status of the book: Chapters 1-10 and 14 finished in a proofread draft. A paper version of the draft is available for purchase at lulu.com

Roadmap:

  • Continue writing up the chapters, announce the availability of each new chapter.

  • Have a final draft ready in early 2021.