Through the lands of static typing


Last December I started my own trip towards Haskell, jumping in with much enthusiasm and curiosity. The Haskell Book has been the perfect companion, and since chapter 12 just ended I would like to write about my progress with this wonderful programming language.

A new house and everything that comes with it gleefully slowed me down on my studies, but Haskell has never left me alone during these months. The Haskell Book is really excellent at guiding me one concept at a time, and I am finally beginning to understand the benefits of static typing.

Coming from Clojure made the first chapters pretty straightforward. This is not to Haskell detriment, of course. It just felt good to be able to reason about lists, recursions, and folds without too much of an effort. Types and typeclasses is where the real fun began, and I can say so far so good. Specifying the type of every function, even when it can be safely omitted, is simple and useful, and it is helping me get a better grasp of the power of static typing.

I must admit writing datatypes scared me at first. Years of Java developing spoiled me on classes and objects, and I swear those datatypes seemed classes to my object-oriented eyes. Shame on me. Kinds and higher-kinded types deserve further study, though. I can write my on datatypes now, albeit trivial ones, but types of type constructors deserve deeper inquiries.

There is one more thing I am really enjoying: the syntax. I know you would expect otherwise from a Clojurist, but Haskell syntax is just lovely. It’s maths all over again, and I am in love with it just as much as I love my parenthesis.

That’s it for now. Monads, here I come.