I ask because I am currently learning Clojure, but wonder if there is something unique that Haskell offers.
I ask because I am currently learning Clojure, but wonder if there is something unique that Haskell offers.
Aside from its technical merits, there's a certain expressive beauty and power to it. For example, I recently wanted to write a command-line version of 2048 in Haskell. Instead of being bogged down in the minutia of keeping track of array indexes and state variables, it was simply a matter of transposing lists (corresponding to board rotations). The entire game fit onto a single screen of code that reads like English (once you’re accustomed to the syntax - please don’t be scared off by that!)
I spent some time learning Clojure. From my limited experience, it’s certainly easier to get up to speed writing working programs with Clojure. The simplicity of LISP syntax is hard to beat. And the fact that it runs atop the JVM makes things like cross-platform GUI programming a breeze compared to Haskell. But while macros are powerful, it really doesn’t compare to the flexibility & composability of Haskell. Haskell provides some powerful abstractions which make building software easier, and these capabilities simply aren’t possible in other languages — check out the Tony Morris videos on monads & monad transformers for more details [1]. He also explores why these abstractions, if they’re indeed so powerful, aren’t currently more prevalent in software engineering. He’s dedicated to changing that.
LYAH is a great resource, but it can be a bit verbose at times.For those interested in diving into the language right away, I recommend checking out the University of Virginia CS 1501 Haskell lectures [2]. They start with the basics and gradually build up to more advanced concepts like functors, monoids, monads, etc. They even have a section on category theory at the end.
For a great intro to web development with Haskell, see Ryan Trinkle’s talk on creating a link shorter (using the Snap web framework with a PostgreSQL backend). [3] Live demo [4]
For a more formal CS-style introduction to Haskell, see the lectures by Prof. Dr. Jürgen Giesl. [5]
[1](http://vimeo.com/robmanthey/videos/page:6/sort:alphabetical/)
[2](http://shuklan.com/haskell/index.html#)
[3](http://vimeo.com/59109358)
[4](http://memoi.se/)
[5](https://www.youtube.com/channel/UC9ZJ-o00b2t79v6er1O-eBQ/vid...)
You better have perfect code coverage, or you'll have no clue why and where something broke (the sink/source problem) or perhaps you won't even find out for a while because that scenario wasn't sufficiently tested and it slips into production. Having a compiler nag you about type inconsistencies is incredibly helpful in these scenarios.
The other big one is working with large blobs of data. Our product has a large analytics component to it, and massaging giant, deeply nested maps representing a certain compendium of statistics is really tough without the compiler spotting you. None of this is an issue when you have to satisfy a certain type, the compiler will basically give you a checklist of things to fix when you change something.
With Haskell you're getting all of the benefits of Clojure (expressiveness, leverage etc), plus the really useful addition of types and enforced purity on top.
Here's another clojurian's experience with switching to Haskell: http://bitemyapp.com/posts/2014-04-29-meditations-on-learnin...
Schema helps (I used to use Mississippi back in the day with all sorts of complex checks, it was ugly), but it's more of an "add-on" in the end. I actually have a reasonably convenient flow for validating outside API input, business logic constraints and performing the necessary operations against the data store all in one big error monad nowadays. The problems is that I still have to go out of my way to add these input/output validation checks to everything when I could just get it for free through the type system.
Look, don't take my word for it: I strongly encourage you to try the two paradigms yourself and see what you think. Unfortunately it's very difficult to see the downsides without a large project, but you can probably extrapolate.
But the data-structures that are built in are pretty slick.