Some time ago when I started learning functional programming I also started to follow functional programmers on twitter. Some day someone stated that error handling should be done with Applicative Functors.
No, Martin Fauler, you should use applicative functors instead http://t.co/kLCJvLazqE
— vaskir (@kot_2010) December 9, 2014
Off course the Fowler way is a very typical, commonly used and approved approach. So what makes it so much better to use Applicative Functors instead? And what are they anyway?
This series of posts will answer these questions. It is the kind of article I was looking for back then but could not find. It is a compilation of all the pieces and resources that I found researching the topic.
In the first part we will cover all the basics that are needed to do error handling in a functional style, and to understand what is going on behind the scenes. We will see how error handling can be done only with immutable objects and without using exceptions.
In the second part of the series we will look at a sample application for parsing command line arguments with error handling in F#.
Content of this series:
-
Error handling with Applicative Functors in F# and C#
Basics of functional error handling -
Functional error handling - parsing command line arguments in F#
Functional error handling in practice (F#) -
Functional error handling – parsing command line arguments in C#
Functional error handling in practice (C#) -
Functional vs. imperative error handling
A comparison of the functional vs. the imperative approach to error handling