Monday, January 10, 2011

Monads in C# – 1. Introduction

Here’s the complete series:
1. Introduction.
2. What’s the point?
I’ve foolishly volunteered to give a talk at DDD9 on the 29th January: ‘Monads! What are they, and why should I care?’:
“Or: How to bend Linq syntax to your will.
These days, monads are the "celebrities of programming language theory". But they also inspire fear in the hearts of lowly imperative programmers like myself. However they are a very useful and powerful abstraction and they pop up everywhere. C#'s Linq syntax is Monadic, for example. Having an understanding of Monads will give you the conceptual tools to greatly simplify many programming challenges, from dealing with nulls and managing state, to asynchronous programming and parsing. This talk will be mostly C#, but I will also be introducing a little F# and even some Haskell.”
Why foolish? Well, firstly, because I’ve only recently come to a limited understanding of what Monads are myself, and I’m fully aware that I’ve got a great deal more to learn. There’s a very good chance that I might not understand some important points, or that I’m just wrong about some things. Secondly, because it’s taken me several books, a gazillion blog posts and articles and upwards of a year to get to my limited understanding. To expect to transfer this to someone else’s brain in an hour’s presentation is completely unrealistic.

Read more: CODE RANT, Monads in C#–2. What’s the point?