3 ms·
About two years ago, before Haskell became my current favorite language, I really liked Common Lisp and Python, and I was transitioning to Clojure. So perhaps I
by js8 10y ago
About two years ago, before Haskell became my current favorite language, I really liked Common Lisp and Python, and I was transitioning to Clojure. So perhaps I can explain what sold me to Haskell from Clojure and Lisps in general. (I also looked at Scala, but I am a little worried about it being too complicated by wanting to be mix of OOP and FP.)
What I really like about Lisps is the ability to define DSLs with functions and macros. I thought Haskell cannot do it very well, although I recognized that the most useful ability of macros - to selectively evaluate arguments - can be replaced with Haskell's lazy evaluation. Then I read the article http://www.haskellforall.com/2012/06/you-could-have-invented-free-monads.html http://www.haskellforall.com/2012/06/you-could-have-invented... and I became sold instantly. Not only Haskell can define DSLs that are on par with DSLs in Lisp, but it also gives you typechecking in those for free!
There are still some use cases where Lisp macros can be stronger than standard Haskell, but not that many.
The other thing I was worried with Haskell was the static typechecking. I am fan of dynamic languages, because they let me write the code without having to type types everywhere. But in practice with Haskell, I was pleasantly surprised; if you stick to the standard things, you don't really need to specify types that much (although I try to specify them for function arguments), Hindley-Milner inference will figure it all out. Specifying types upfront is still a trade off, but I found I don't really mind it if I don't have to write them everywhere as I have in Java or C.
Haskell also isn't complicated language, it turns out, most features are either some obscure typing extensions to HM which you will avoid as a beginner anyway or just syntactic sugar over some kind of function composition.
And I really like the functional approach, such as monadic representation of side-effects (which gives you ability to reinterpret actions done by some function differently). It's a powerful paradigm I think even though I am not very good at it yet.
I even joke that it's simpler than Java, because the Java people have to be really smart to work with all those objects and patterns, where I can make do with types and functions (and an occasional type class), and I am not so smart, so I prefer Haskell. (There is truth to it, IMHO, the relatively clean and abstract design of Haskell makes many high order things more straightforward than in Java.)