The Journey Begins: Functional Programming

For a while now I wanted to dive into Functional Programming to properly learn how to use functional-lite concepts in JavaScript. It took me some time to window shop for a language that I was satisfied with. The main criteria for me were language usage, popularity, ease of tooling and, most important, learning material. I didn't want to learn just the language, my goal was to learn functional programming and the language should be the medium.

I've looked at Haskell and Elm. Considered Scala, Clojure, and F#. Checked out Racket, Lisp, and Scheme. And wondered about OCaml / ReasonML and Erlang. That's quite a list, and that's only scratching the surface.

Choosing a language

In the end, my choice fell on Haskell because of available learning materials and its purity. It would force me to learn how to properly use functional programming concepts and not revert back to imperative style while facing difficulties.

Companions #

A Taste of Haskell #

An quick example from Introduction to Functional Programming course to whet one's appetite for what's to come.

-- Quicksort
f :: (Ord a) => [a] -> [a]
f [] = []
f (x : xs) = ys ++ [x] ++ zs
where
ys = f [ a | a <- xs, a <= x ]
zs = f [ a | a <- xs, a > x ]

Beautiful.



You've made it to the end! Sharing this article on your favorite social media network would be highly appreciated 🧑‍💻! For more information you can find me on Twitter.

Published