- Why use F#? A one page tour of F#. If you like it, there is a 30 page series that goes into detail on each feature.
- Installing and using F# will get you started.
- F# syntax in 60 seconds
- Learning F# has tips to help you learn more effectively.
- Troubleshooting F# for when you have problems getting your code to compile.
and then you can try…
- Twenty six low-risk ways to use F# at work. You can start right now – no permission needed!
- Thinking functionally starts from basics and explains how and why functions work the way they do.
- The “Introduction to functional design patterns” talk and the “Railway Oriented Programming” talk provide more examples of the functional way of thinking.
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.
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.
These talks and posts explain some core patterns in functional programming – concepts such as “map”, “bind”, monads and more.
- Talk: Introduction to functional design patterns.
- Talk: Railway Oriented Programming: A functional approach to error handling. See linked page for associated posts.
- Monoids without tears: A mostly mathless discussion of a common functional pattern.
- Talk: Understanding Parser Combinators: Creating a parser combinator library from scratch. See linked page for associated posts.
- Talk: State Monad: An introduction to handling state using the tale of Dr Frankenfunctor and the Monadster. See linked page for associated posts.
- Reader Monad: Reinventing the Reader monad.
- Map, bind, apply, lift, sequence and traverse: A series describing some of the core functions for dealing with generic data types.
- Fold and recursive types: A look at recursive types, catamorphisms, tail recursion, the difference between left and right folds, and more.
- The “A functional approach to authorization” Series. How to handle the common security challenge of authorization using “capabilities”. Also available as a talk.
- An introduction to property-based testing
- Choosing properties for property-based testing
- Talk: Property-based testing: the lazy programmer’s guide to writing 1000’s of tests.
These posts provide detailed worked examples with lots of code!
- Commentary on ‘Roman Numerals Kata with Commentary’. My approach to the Roman Numerals Kata.
- Worked example: Designing for correctness: How to make illegal states unrepresentable (a shopping cart example).
- Worked example: Stack based calculator: Using a simple stack to demonstrate the power of combinators.
- Worked example: Parsing command lines: Using pattern matching in conjunction with custom types.
- Worked example: Roman numerals: Another pattern matching example.
- Calculator Walkthrough: The type-first approach to designing a Calculator.
- Enterprise Tic-Tac-Toe: A walkthrough of the design decisions in a purely functional implementation
- Writing a JSON Parser.
- Four key concepts that differentiate F# from a standard imperative language.
- Understanding F# indentation.
- The downsides of using methods.
- Formatted text using
- Match..with expressions and creating folds to hide the matching.
- If-then-else and loops.
- Option Types especially on why None is not the same as null.
- Record Types.
- Tuple Types.
- Discriminated Unions.
- Algebraic type sizes and domain modelling.
F# for C# Developers:
- Ten reasons not to use a statically typed functional programming language. A rant against something I don’t get.
- Why I won’t be writing a monad tutorial
- Is your programming language unreasonable? or, why predictability is important.
- We don’t need no stinking UML diagrams or, why in many cases, using UML for class diagrams is not necessary.
- Introvert and extrovert programming languages
- Swapping type-safety for high performance using compiler directives