The Science of Functional Programming
$7.99
Minimum price
$9.99
Suggested price

The Science of Functional Programming

A tutorial, with examples in Scala

About the Book

This pedagogical tutorial book presents the theoretical knowledge needed by practitioners of the functional programming paradigm. The main topics covered are: working with functional collections and recursion; the fundamental type and code constructions in functional programming; reasoning about types and code with the Curry-Howard correspondence; laws, structure theorems, and code derivation for functors, monads, and other important typeclasses; free type constructions; and parametricity theorems. Detailed explanations are logically developed and accompanied by full derivations and worked examples tested in the Scala interpreter, as well as exercises. Readers should have a working knowledge of programming; e.g. be able to write code that reads a small text file and prints the number of words in it. The mathematical complexity of the calculations in this book is at the level of undergraduate calculus, similar to simplifying the expressions 1/(x-2) - 1/(x+2) and (d/dx)((x+1)f(x)exp(-x)).

  • Share this book

  • Categories

    • Functional Programming
    • Scala
    • Computer Science
  • Installments completed

    15 / 16

  • Feedback

    Email the Author(s)

About the Author

Sergei Winitzki
Sergei Winitzki

Sergei Winitzki has a PhD degree in theoretical physics and, after an academic career in research, now works as a big data engineer. He is passionate about functional programming, declarative programming, and domain-specific languages.

Table of Contents

  • Preface
  • Part I. Beginner level
    • 1 Mathematical formulas as code. I. Nameless functions
    • 2 Mathematical formulas as code. II. Mathematical induction
    • 3 The logic of types. I. Disjunctive types
  • Part II. Intermediate level
    • 4 The logic of types. II. Curried functions
    • 5 The logic of types. III. The Curry-Howard correspondence
    • 6 Functors and contrafunctors
    • 7 Reasoning about code. Techniques of symbolic derivation
    • 8 Typeclasses and functions of types
    • 9 Computations in functor blocks. I. Filterable functors and contrafunctors
    • 10 Computations in functor blocks. II. Semimonads and monads
    • 11 Applicative functors and contrafunctors
    • 12 Traversable functors
  • Part III. Advanced level
    • 14 Computations in functor blocks. III. Monad transformers
  • Part IV. Discussions
    • 16 "Applied functional type theory": A proposal
    • 17 Essay: Software engineers and software artisans
    • 18 Essay: Towards functional data engineering with Scala
    • 19 Essay: Why category theory is useful in functional programming
  • Part V. Appendices
    • A Notations
    • B Glossary of terms
    • C Inferring code from types. The LJT algorithm
    • D Parametricity theorem and naturality laws
    • E Solutions of some exercises
    • F A humorous disclaimer
    • G GNU Free Documentation License

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.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

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

In fact, authors have earnedover $13 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