Essential F#
Free!
Minimum price
$7.99
Minimum paid price

Essential F#

About the Book

Everywhere you look, programming languages are gaining functional features. The problem is that it's not the individual features that make functional programmers happy, it's the way that your approach to writing software and the features work together to help you write simple code to solve interesting problems. This book will help you to discover why F# is such a popular language with those who have spent time learning its secrets. 

This book started life as a series of blog posts I wrote for the Trustbit website (https://trustbit.tech/blog). The sum of the content is the core of what a developer needs to know to be able to work on one of their F# Line of Business codebases. I have improved and extended the content, upgraded the code to F# 5, and ensured that the code would run in VS Code with the free ionide extension.

This book is FREE. If someone feels that they want to pay money for it, the author's royalties (80%) will continue to go to the F# Software Foundation.

You can report issues with this book to https://github.com/ijrussell/essential-fsharp.

About the Author

Ian Russell
Ian Russell

I’ve been writing software for nearly 30 years, with the last 20 in the .NET (Core) space. I have been using C# since 2003 and F# since 2010. My core skills are in Domain-Driven Design, Distributed Systems, Event-Driven Architecture. I partularly enjoy working on complex domains and highly scalable systems.

I work remotely from the UK for a Company based in Vienna, Austria.

Reader Testimonials

MAFINA KHAN
MAFINA KHAN

Software Developer at Amazon

That book is one of the best ways to learn F#. It still amazes me how you packed such detail in only 200 pages.

CHET HUSK
CHET HUSK

PM @MICROSOFT

One of the essential cornerstones of #fsharp, freshly redone. Congrats @ijrussell, and enjoy it, future-f#-devs!

STEFAN ROHLFING
STEFAN ROHLFING

I've been using F# for some time, mainly to automate tasks, so I have a bit of experience with the language. Your teaching approach is helping me connect the dots and get a better understanding of the concepts.

JOEL GARPLIND
JOEL GARPLIND

I read your book on F# some 2 years ago, and it really helped me to grip the fundamentals of the language. For context, I work for a company using a lot of F#, so being somewhat well acquainted with it has helped me a lot. Thanks for writing and sharing the book

HOUSTON H. HAYNES
HOUSTON H. HAYNES

Ian is a tremendous writer and does a great job in approaching #fsharp both in finding commonalities with other technologies as well as clearly showing where the language effectively stands apart. Highly recommended! I appreciate the conversational style -- #fsharp as an ecosystem is blessed with a broad set of explainers - each with their own perspective. The language and is deep & wide enough that it deserves expansive treatment. I feel like your book has helped me with fresh approaches.

DARREN PLATT
DARREN PLATT

Genetical Engineer

This is an excellent intro into a beautiful programming language.

WILTON HOTZ
WILTON HOTZ

This got me started on my F# journey, and now there's no going back!

DYOWEE SAMONTE
DYOWEE SAMONTE

Really an enjoyable book to read :)

RYAN O'NEILL
RYAN O'NEILL

It's ok, I bought Ian's book and have still not read it either. Just knowing I have it makes my F# magically better.

 SWARAJ YADAV
SWARAJ YADAV

Book is quite good :)

Table of Contents

  • Preface
    • Contents
    • F# Software Foundation
    • About the author
  • Acknowledgments
  • Getting Started
    • Setting up your environment
    • One Last Thing
  • 1 - An Introductory Domain Modelling Exercise
    • The Problem
    • Getting Started
    • Making the Implicit Explicit
    • Going Further
    • Alternative Approaches (1 of 2)
    • Alternative Approaches (2 of 2)
    • Summary
    • Postscript
  • 2 - Functions
    • Getting Started
    • Theory
    • In Practice
    • Unit
    • Anonymous Functions
    • Multiple Parameters
    • Partial Application (Part 1)
    • The Forward Pipe Operator
    • Partial Application (Part 2)
    • Summary
  • 3 - Null and Exception Handling
    • Null Handling
    • Interop With .NET
    • Handling Exceptions
    • Function Composition With Result
    • Summary
  • 4 - Organising Code and Testing
    • Getting Started
    • Solutions and Projects
    • Adding a Source File
    • Namespaces and Modules
    • Writing Tests
    • Writing Real Tests
    • Using FsUnit for Assertions
    • Summary
  • 5 - Introduction to Collections
    • Before We Start
    • The Basics
    • Core Functionality
    • Folding
    • Grouping Data and Uniqueness
    • Solving a Problem in Many Ways
    • Working Through a Practical Example
    • Summary
  • 6 - Reading Data From a File
    • Setting Up
    • Loading Data
    • Parsing Data
    • Testing the Code
    • Final Code
    • Summary
  • 7 - Active Patterns
    • Setting Up
    • Partial Active Patterns
    • Parameterized Partial Active Patterns
    • Multi-Case Active Patterns
    • Single-Case Active Patterns
    • Using Active Patterns in a Practical Example
    • Summary
  • 8 - Functional Validation
    • Setting Up
    • Solving the Problem
    • Where are we now?
    • Functional Validation the F# Way
    • Summary
  • 9 - Single-Case Discriminated Union
    • Setting Up
    • Solving the Problem
    • Using Modules
    • A Few Minor Improvements
    • Using a Record Type
    • Summary
  • 10 - Object Programming
    • Setting Up
    • Class Types
    • Interfaces
    • Object Expressions
    • Encapsulation
    • Equality
    • Summary
  • 11 - Recursion
    • Setting Up
    • Solving The Problem
    • Tail Call Optimisation
    • Expanding the Accumulator
    • Using Recursion to Solve FizzBuzz
    • Quicksort using recursion
    • Recursion with Hierarchical Data
    • Other Uses Of Recursion
    • Summary
  • 12 - Computation Expressions
    • Setting Up
    • Introduction
    • The Result Computation Expression
    • Introduction to Async
    • Compound Computation Expressions
    • Debugging Code
    • Further Reading
    • Summary
  • 13 - Introduction to Web Programming with Giraffe
    • Getting Started
    • Using Giraffe
    • Creating an API Route
    • Creating a Custom HttpHandler
    • Creating a View
    • Adding Subroutes
    • Reviewing the Code
    • Summary
  • 14 - Creating an API with Giraffe
    • Getting Started
    • Our Task
    • Sample Data
    • Routes
    • Handlers
    • Using the API
    • Summary
  • 15 - Creating Web Pages with Giraffe
    • Getting Started
    • Configuration
    • Adding a Master Page
    • Creating the Todo List View
    • Loading Data on Startup
    • Summary
  • Summary
    • F# Software Foundation
    • Resources
    • And Finally
  • Appendix 1
    • Creating Solutions and Projects in VS Code
  • Appendix 2
    • CSS and JavaScript for Chapter 15

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 $14 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