Explore this site

A guide for visitors

Getting started

and then you can try…

Thinking Functionally

Understanding F#

The following are tutorials on the key concepts of F#.

  • Talk: F# for C# Developers
  • Expressions and syntax covers the common expressions such as pattern matching, and has a post on indentation.
  • Understanding F# types explains how to define and use the various types, including tuples, records, unions, and options.
  • Choosing between collection functions. If you are coming to F# from C#, the large number of list functions can be overwhelming, so I have written this post to help guide you to the one you want.
  • Understanding computation expressions demystifies them and shows how you can create your own.
  • Object-oriented programming in F#.
  • Organizing modules in a project in which we look at the overall structure of a F# project. In particular: (a) what code should be in which modules and (b) how the modules should be organized within a project.
  • Dependency cycles. One of the most common complaints about F# is that it requires code to be in dependency order. That is, you cannot use forward references to code that hasn’t been seen by the compiler yet. In this series, I discuss dependency cycles, why they are bad, and how to get rid of them.
  • Porting from C#. Do you want to port C# code to F#? In this series of posts we’ll look at various approaches to this, and the design decisions and trade-offs involved.

Functional Design

These talks and posts show how FP-oriented design is different from OO design.

  • Talk: Domain modelling with the F# type system. Statically typed functional programming languages like F# encourage a very different way of thinking about types. The type system is your friend, not an annoyance, and can be used in many ways that might not be familiar to OO programmers. Types can be used to represent the domain in a fine-grained, self documenting way. And in many cases, types can even be used to encode business rules so that you literally cannot create incorrect code. You can then use the static type checking almost as an instant unit test – making sure that your code is correct at compile time.
  • Designing with types explains how to use types as part of the design process, making illegal states unrepresentable.
  • Algebraic type sizes and domain modelling
  • Talk: The Power of Composition. Composition is a fundamental principle of functional programming, but how is it different from an object-oriented approach, and how do you use it in practice? In this talk for beginners, we’ll start by going over the basic concepts of functional programming, and then look at some different ways that composition can be used to build large things from small things.
  • Talk: Thirteen ways of looking at a turtle demonstrates many different techniques for implementing a turtle graphics API, including state monads, agents, interpreters, and more! See linked page for associated posts.
  • Talk: Enterprise Tic-Tac-Toe. Follow along as I ridiculously over-engineer a simple game to demonstrate how functional programming can be used to create a real-world “enterprise-ready” application.
  • Talk: Designing with Capabilities demonstrates a very different approach to design using “capabilities” and the principle of least authority. I’ll show how using these design techniques throughout your core domain (and not just at your API boundary) also leads to well-designed and modular code.

Functional Patterns

These talks and posts explain some core patterns in functional programming – concepts such as “map”, “bind”, monads and more.

Testing

Examples and Walkthroughs

These posts provide detailed worked examples with lots of code!

Specific topics in F#

General:

Functions:

Control Flow:

Types:

F# for C# Developers: