5 ms·
Most arguments I've come across seem to be of the type "FP will make you a smarter programmer and better person, just try it and you'll see. Lot's of programmer
by pav3l 14y ago
Most arguments I've come across seem to be of the type "FP will make you a smarter programmer and better person, just try it and you'll see. Lot's of programmers are too dumb to get it though, so don't feel bad if you're one of them". I was hoping that someone here could provide some more concrete explanations of when Haskell & company should be used over imperative/OO designs. For example, the most watched Haskell repo on Github seems to be pandoc, an engine for converting text from one markup to another. What is it about functional programming that makes it better suited for this particular task then, say, Perl? Or is pandoc written in haskell for purely historical reasons? Maybe there is a better example.
- dons 14y agoPandoc is a compiler from N input grammars to M output grammars. Compilers are easy to write in typed, functional languages because they have algebraic data types and pattern matching.
- deleted 14y ago[deleted]
- ozataman 14y agoPure functional programming typically shifts thinking overhead from your brain as the programmer to the compiler (and the very design of the language). After using Haskell intensively for the past ~4 years, if I go back and write software in Python/Ruby/etc., I realize: - How annoying it is to have to keep state (of objects, data structures, etc.) in mind for pipelines of computations - How bad mutability in data structures is and how wonderful it is that in Haskell you NEVER have to worry about any of the data structures changing under your feet - How nice it is that you can refactor massive codebases fearlessly, thanks to purity and the expressive type system - How cool QuickCheck and unit testing is in Haskell vs. the mainstream OO languages - That even Ruby feels lower level and more verbose after Haskell due to a lack of higher-order/first-class functions, among other things - that if I'm using a dynamically typed language, it sucks that I'll likely get 1 - 10% of the performance I would get if I were using Haskell with no real special tricks ... the list goes on.