F# Deep Dives

F# Deep Dives

F# Deep Dives is a collection of case studies that demonstrate how to use functional-first programming in practice. Each chapter is written by an F# expert and is based on their use of F# in industry. You can get the book from Manning.com, from Amazon.com or Amazon.co.uk or your favorite book store.

F# Deep Dives

Reviews and quotes

Thanks to everyone who wrote a review or posted a comment about theF# Deep Dives book. Thanks to the Manning Early Access program, the book was available to the readers even before it was completed, which gave us some very valuable feedback.

Blogs and Online Magazines

First of all, I want to mention that it is not a usual book about F# or another programming language. If you are novice to F# and looking for a guide of language constructs – this book is not the best choice for you. BUT, if you are already familiar with F# basic syntax constructs, can read simple F# code samples and want to see the language in action – this book is for you.

(...) Finally, I want to say that the book is really good. Everyone will find interesting topics and a new experience. You will get a broader vision of F# application in a real life. You will see how a functional approach can change and simplify the architecture of real life apps. If you are looking for what to read next – take a look at “F# Deep Dives“, this book is really deserves it

As many readers of my writing will already know, I've been kind of "involved" with F# (and its cousin on the JVM, Scala) for a few years now, to the degree that I and a couple of really smart guys wrote a book on the subject. Now, assuming you're one of the .NET developers who've heard of F# and functional programming, and took a gander at the syntax, and maybe even bought a book on it (my publisher and I both thank you if you bought ours), but weren't quite sure what to do with it, a book has come along to help get you past that.

As of this writing, the early-access (...) version had only Chapters 3 (...) and Chapter 11 (...), but the other topics (...) are juicy and meaty, and both Tomas and Philip are recognized names in the F# space. (...) In particular, the Markdown parser they implement in chapter 3 is a great example of a non-trivial language parser, which is not an easy task to approach but certainly a lot easier to do in a functional language. (...)

From the book cover

Finally! A book that shows a wide variety of applications for F#.

Jonathan DeCarlo Bentley Systems, Inc.

Beautifully written by F# experts — take a deep dive without holding your breath.

Kostas Passadis, IPTO

Outstanding real-world examples that are sure to appeal to both the novice and expert.

Jeff Smith ITT Education Services

I love the Deep Dives concept. This book is full of insights about how to apply the power of F# to real-world problems.

Dennis Sellinger, Géotech SARL

Social networks etc.

A must have book for every F# programmer.

John Tarbox

Got F# Deep Dives book. Can't wait to read it as it's exactly the type of #fsharp book that we need!

Billy Stack

Samples and related free material

Currently, two of the book chapters are available as free samples from Manning. You can also get the full source code and additional information from the front matter of the book. We are working on releasing additional excerpts from some of the chapters, which will appear here when published!

  • Source code contains commented source code for all the chapters. Sometimes containing even more than you'll find in the book!
  • Preface explains the motivation behind this book and how it differs from other books on F# and functional programming.
  • About gives you a brief overview of the contents of the book and the topics of the individual chapters.
  • Table of contnets shows you a detailed structure of the book and what topics you'll find in it.

Sample chapters

The following two chapters are available as free samples:

  • Chapter 1: Succeeding with functional-first programming in the industry (Tomas Petricek and Don Syme) looks at the business motivations behind using functional-first programming languages. What are the problems faced by businesses when developing software (and especially analytical components)? And how does F# help to solve those?
  • Chapter 5: Understanding social networks (Evelina Gabasova) uses F# to understand social networks and more specifically Twitter. It is a great example of end-to-end data analysis with F# - starting from data access, implementing algorithms such as Page Rank and visualizing data using the D3 visualization library.


We tried to minimize the number of errors in the book as hard as I could. However, some errors are (unfortunately!) inevitable. This page contains the list of known issues. If you spot an issue that isn’t listed on this page, please send an email to Tomas at tomas@tomasp.net.

Chapter 2

  • Page 28 (Listing 2) The last three lines of the code in the listing look as follows:
    |> Seq.sumBy (fun k -> f(!n) /
                                (f(!k) * f(!(n-k))) *
                                p**(f(k) * (1. - p)**f(n-k)))
    This should be the same as the code that appears later on page 29 (i.e. additional parentheses are needed around ** to specify the correct priority; also we first multiply the two factorials and then covert the result to float):
    |> Seq.sumBy (fun k -> f(!n) /
                                (f(!k * !(n-k))) *
                                (p**(f(k))) * ((1. - p)**f(n-k)))

Chapter 4

  • Page 77 (sidebar) The first line in the sidebar says Var(X) denotes the expectation of random variable X.
    This should instead read Var(X) denotes the variance of random variable X.

Chapter 8

  • Page 194 The first paragraph (below listing 17) says listing 18 shows an asynchronous version of listing 17. The reference to previous listing is incorrect. The correct is: listing 18 shows an asynchronous version of listing 13.

Chapter 9

  • The chapter has been written based on Microsoft XNA Framework which has been discontinued since the publication of the book. However, a compatible implementation is available under the name MonoGame. All the concepts discussed in the chapter still apply (to MonoGame and to game programming in general), but the installation details are no longer accurate. Please see MonoGame and community efforts to build open-source version of XNA.


  • Page 329 The last line of listing 1 shows val answer1 : int = 42, but the correct output should be val answer2 : int = 42.

   Go back to the top