In an object-oriented context a typical way to do error handling is to use the Notification Pattern described by Martin Fowler.
In functional programming (FP) the approach to error handling is very different. Error handling has to be done without mutating state and without the use of exceptions. The concept that is capable of this, and that is commonly used in FP is called "Applicative Functor".
In this post, which is the first part of the series Functional error handling in F# and C#, we will cover all the basics that are needed to do functional error handling in F# and C#, and to understand Applicative Functors.
The F# and C# code samples from this post can be found here.
In the second part of the series we will look at a sample application for parsing command line arguments with error handling in F#.
Anyway, before we jump right into it, we will need some introduction.
Continue reading →