|
For a long time now I've been looking at Haskell from the outside, and wondering whether I should take the dive and learn the language. I usually write apps and games, though, and my gut has always told me that there's very little advantage to writing code that's primarily declarative, imperative, or reactive in a pure-functional manner. Sure, I use some functional principles to minimize code complexity, but I haven't made the commitment to learning a new language to experience the purity. Still, reading blog after blog telling me how awesome functional programming is, and meeting people in person who swear by it, and who try to sway me to the religion, made me desire to learn FP, just in case they were all right. I try to improve myself when I can, and ignoring other developers' advice isn't a good way to improve yourself. But after reading this well-written article, I am at peace with my long-standing de facto decision not to burn time learning Haskell. I'll continue to use functional code organization when appropriate, and I'll probably keep reading the articles from time to time, but to me deterministic speed of execution is far more important than "code purity." I'm a good developer precisely because I'm good at understanding how code effects propagate, I'm good at designing code to be clean and fast, and I know when to allow side-effects and when to forbid them. I don't feel the need of a crutch to make my code "more correct," and I already have access to several options to help me make my code more concise. I wish I'd seen this (2009?) article sooner. So no Haskell for me. Long live Python/Lua/JavaScript/C++/Go/and who knows what's next. [1] [1] Those are the languages I currently use the most. I make no claim that they are better or worse in some abstract way than Haskell. In concrete ways, however... ;) |
- type classes and their associated laws (e.g. generalize mapping: it's obvious that you can map across a list. it's less obvious that you can also map across a Maybe. it's even less obvious that you can map across a function...)
- sum types
- functions as a distilled programming concept without ancillary implementation details such as C's or C++'s "unique address" rules
- restricted effects - subsetting IO for stronger static guarantees (like c++'s const but way more powerful). STM was built this way. BufferBuilder too. http://chadaustin.me/2015/02/buffer-builder/ It's a powerful technique in Haskell that you don't get in other languages.
- the realization that monomorphization is a generics implementation detail
- the feeling that you get from generic, terse, dynamic-looking code that you can still rapidly iterate on in a repl
Haskell is not some pure ivory tower - there is plenty of imperative stateful code written in Haskell. The value of Haskell is that it introduces a pile of powerful ideas that you will carry through the rest of your career, even if you don't write Haskell on a day-to-day basis.