I love functional programming. I hope in the future it will be used by many more organizations and developers. And I think that it's quite easy to use. Unfortunately, there are many people who find that functional programming is difficult. There is a big problem that prevents people from finding functional programming easy, and that is functional programming isn't accessible. Functional programming is filled with language and concepts such as higher-order function, higher kinded type, algebraic data types, Functor, Monoid, Monad, etc. It's too theoretical, and not very practical. What happens when you try to dig deeper to understand the concepts, for example when you search for 'monad'? You get definitions that are really hard to understand. Wikipedia defines a monad as
In functional programming, a monad is a software design pattern with a structure that combines program fragments (functions) and wraps their return values in a type with additional computation.
This frustrates me because the concept of monad is actually quite simple, but this definition only raises more questions.
This guide is intented to make functional programming accessible. I'll show just how simple Functors and Monads (and other FP concepts) really are using simple, practical language and many examples. We can get into the complicated technical, mathematical definitions later.
I am writing this guide for someone who already has some experience programming, either in a functional programming language or an object oriented one. You may find it difficult to follow along if you don't have some experience (but you're welcome to continue reading anyways). I will be providing examples in TypeScript to help bridge the gap between object-oriented programming and functional programming. I will also be providing examples in PureScript because it is very similar to Haskell and is pretty easy to set up because it can be run in Node. I will not be teaching the syntax of either TypeScript or Purescript, but I will link to resources that do.