Haskell vs Clojure

Experience report on Haskell vs Clojure

Having multiple years of experience in each of these languages, I think I can shed some light on this. I would still prefer Haskell for writing code where correctness is of great importance (e.g. finance). I would prefer Haskell’s powerful type system over any other rule based system. It makes me feel safe in a way that Clojure doesn’t.

This is because Haskell emphasizes (measurable) correctness over anything else. In my experience, once the code compiles, it does exactly what I intended in >90% of the time (and if not, it’s usually because of issues that are outside the domain that Haskell can control, e.g. protocol errors with third party integrations). If I want to enforce certain behavior and correctness by design, Haskell is my language of choice.

All this takes a toll, and Haskell is definitely not simple. Clojure has a different philosophy: rather than going through great lengths to provide an sense of control over correctness, it let’s me approach problems in a completely different way. Rather than wrapper things around a certain type and enforcing certain properties of that type, it does away with this entirely and let’s me work directly with the data. This makes it a lot easier to see the complete picture, and kind of drives me to iterate on the problem / solution fit until I find the simplest of both. This is a completely different approach to write bug-free code, but a powerful one as well.

In addition, I am easily 2x-5x more productive using Clojure, which gives me more time actually thinking about the problem, and REPL based programming has been an eye-opener. It allows you to experiment easier, which in turn is a leaner approach, and makes you ditch bad solutions before you’re too invested.

All in all, I strongly believe it’s an apples/oranges comparison, and it’s really difficult to quantify whether one makes you write better solutions than the other. In almost all cases, it’s the broader business scope and context that determines what kind of language you should choose to solve your problems.


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *