Verity Stob Teaches Functional Programming
The article Learn you Func Prog on five minute quick! by Verity Stob (The Register) provides a typically twisted and unhelpful overview of the state of functional programming in this 21st-century renaissance—heralded decades ago by Lisp programmers. It includes an honest overview of the major players, including Scala, for which the “pro” and “con” are the same (a “[c]lose relationship with Java […]”) and ending with JavaScript, for which the “pro” is “It’s what you’ll end up using.”
The discussion continues with rules: variable immutability, function purity, curryability and monadicity, which is where things really go off the rails. Property 7 dribbles to a shuddering halt with,
“All monads define a
unit()function calledof(), abind()function calledmap()and a type constructor function called…“Wait a minute. Wait a minute. Perhaps
bind()is a functor not a function. I’m pretty sure about that. Hold on to the horses a moment there while I look it up.“…And I should perhaps clarify that this
bind()andmap()is nothing to do with any otherbind()ormap()methods or functions that you might be familiar with, although their actions are in some sense quite similar.“Summary: It has been an honour and a pleasure to clear all that up for you.
“Final Reader’s comment: My gratitude is inexpressible.[1]”
Which is not to say that I don’t enjoy immensely the functional aspects of C#. I do. I also have read a lot about monads and am completely familiar with the tragically bad and unenlightening explanations. Stob captures this elegantly with the following corollary to Rule 4:
↩“If you should by some accident come to understand what a Monad is, you will simultaneously lose the ability to explain it to anybody else.”