Essential F#
Free!
Minimum price
$0.00
Suggested price

Essential F#

About the Book

This is a practical book aimed at efficiently getting you up to speed with the essentials of functional-first programming in F#. 

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

My name is Ian and I’ve been writing software for over 25 years, most of it in the .NET (Core) space. I have been using C# since 2003 and F# since 2012. I have been a regular presenter at .NET User Groups and community conferences around the UK, mainly talking about F#, functional programming, and Domain-Driven Design.

I’m a qualified Teacher of Mathematics who decided in my final year of training that I preferred computers to children. :)

I’ve written a free ebook, Essential F#, which you can download from https://leanpub.com/essential-fsharp.

Many of my previous F# blog posts can be found on the Trustbit blog (https://trustbit.tech/blog).

I’m currently learning golang.

Reader Testimonials

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.

CHET HUSK
CHET HUSK

PM @MICROSOFT

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

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.

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 :)

 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.

See full terms

Do Well. Do Good.

Authors have earned$12,130,341writing, publishing and selling on Leanpub, earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.

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