03 Mar 2013, 23:05

Haskell

Back in my 2nd year in college (1990), I took a half year course on functional programming. Back then, having several years of heavy duty Z80 assembly videogames programming, and being recently introduced to high level languages via Pascal and Modula 2, my brain was very fresh and open to new paradigms and ideas. Structured languages like Pascal and C were a great way to remove some of the tedium and bureaucracy of assembly, but functional was mindblowing. I already understood the idea of passing functions around as parameters, since we did a lot of that in our semi-OOP approach to game character behaviour. But when you create your first infinite list, wow, that’s a moment to remember!

So I went on, learned my Caml Light in college, some Lisp which was fascinating but I never found a use for, and even Prolog which was mindblowing in a different way. For practical purposes outside of school, however, I just moved from assembly to C and then C++ as my primary development languages. I still used function parameters and some other patterns in C/C++, but for the most part I’ve been an imperative, OOP kind of guy for two decades.

About a year ago I became interested in JavaScript. While there’s a lot of crap code written in JavaScript, and the language has many warts and quirks, it is a great language for prototype development in both client (via HTML5 Canvas) and server (via NodeJS). JavaScript is so free form that it allows many paradigms and idioms, and one that enjoys some popularity is functional programming. That’s how I became curious about it again. But while functional is a very practical philosophy to apply in JavaScript, the language is not quite enough to support everything that functional has to offer. I had to look at other languages. Ruby is only semi-functional. Clojure is too lisp-like (i.e. hard to read) for my taste. Scala seems to suffer from C++’s kitchen-sink overgrowth. Haskell is feared by many and mastered by few, but those who love it seem to be incredibly smart people (thankfully, my brother is one of them :)), so with that little background I decided to go into it.

Over the past few weeks, I have stolen a few hours here and there to toy with the language. It’s been an interesting ride so far, but there’s a lot yet to discover. The main sources of learning and reference are:

If I can find time, I will write more posts about my learning process with the language.