Some background: I worked professionally in Haskell for over two years from 2010-2013. I have been programming in Clojure since 2008.
I’ve thought long and hard about why I prefer Clojure to Haskell, even though I think Haskell is a very fine, well-designed language. I’ve tried to figure out the precise points, which have evolved over the years. My Haskell experience is only a little in a college class and at one company, so I’ve tried to separate the company’s practices from the language (which was hard!).
Every language has faults, and I’m not just going to pile onto the problems with Haskell. I want to focus on the few things that matter in my choice.
Okay, so here are the reasons why I prefer Clojure:
Fast feedback is the number one thing I look for in a language.
I found in Haskell that it might take 2 hours to get code to compile. People would say that “once you get it to compile, it just works”. But I found that I often couldn’t even remember what I was trying to do. Or I would run it and realize it wasn’t doing what I wanted and it had to be redone. 2 hours just to find that out!
Though very often the compiler errors were useful and helped guide me, I was totally divorced from the actual problem I was solving for that long period of time. That never happens in Clojure. There are long debugging sessions in Clojure, but I’m in there with the code and the problem.
Even without that problem, Clojure just wins here. It is much easier to write code at the REPL and eventually get it into production code.
Back in 2012, we did lack some libraries. We were shelling out to curl for some things because the libCurl wrappers didn’t have the feature set we needed. It worked, but it was less than ideal. There was nothing we needed to do that we couldn’t work around somehow. This has likely changed in the years since I’ve worked in Haskell.
Clojure gets to use the industry tested Java libraries. Clojure wins here. I’m also familiar with the JVM, so I have a personal advantage there.
Haskeller in Clojure land
I’m not an expert Haskeller by any means, but I did learn a lot about its powerful type system. I eventually learned to write code that would compile the first time–which meant having a copy of the type checker running in my head. Now, when I’m in Clojure, I can still use that type checker. I can take it with me wherever I go. It’s not quite the same as having it enforced automatically, but it’s there.
Now, what that means is I can use the good parts of Clojure and the killer advantage Haskell has. If the type checker or the strict lack of side effects is getting in the way, I can still use the flexible Clojure language. But if I want the strict type discipline, I’ve got it.
You can’t get that the other way–a Clojurist moving to Haskell. This is of course based on personal experience, so I can’t expect others to have this advantage. And this doesn’t work on a team, either, where Haskell would enforce the types regardless of good or bad practices.
All that said, I often miss the type system. And I want to check out Haskell again soon!