7 ms·
I've been meaning to ask this for a while now: what's the appeal of Haskell? It doesn't come off as a pleasure to program in. Could someone who knows the langua
by film42 13y ago
I've been meaning to ask this for a while now: what's the appeal of Haskell? It doesn't come off as a pleasure to program in. Could someone who knows the language share their thoughts?
- asdasf 13y agoThe appeal for me is that it is an expressive, high level language with a useful type system and high performance. It is a pleasure to program in.
- egonschiele 13y agoI love programming in Haskell! Seriously, the reason it's on HN so much is that Haskellers love the language. Here are some reasons: * Types, types, types. You're probably sick of hearing about Haskell's type system, but it's amazing. Gives you almost all the flexibility of a language like Ruby, PLUS you can encode a lot of your assumptions in types...so if there's a bug you'll catch it at compile time. I like how I can just write a LOT of Haskell code without testing it, and then just compile my project and find all the issues I need to fix. It makes prototyping really easy and fast. * Awesome abstractions. Functors, monads, first class functions: you know how java is verbose and you end up writing the same boilerplate over and over? Haskell is the opposite. * Awesome syntax. I really love Haskell's syntax: super clean, and you can modify it however you like. I like writing very readable code (you read code way more often than you write it) and Haskell lets me write very readable code. * Neat libraries! All that stuff other languages are trying to work around? Like concurrency, or sandboxing? Part of the standard library already. I had written this post a while back (http://adit.io/posts/2012-03-10-building_a_concurrent_web_scraper_with_haskell.html http://adit.io/posts/2012-03-10-building_a_concurrent_web_sc...) that shows exactly how easy it is. Seriously, if you're curious about languages at all, give Haskell a try.
- tel 13y agoI think something that's hard to appreciate before you learn Haskell is that while a lot of the abstractions used in the language are more complex and abstract than you're used to using, it's because the language/types/compiler help to lift an enormous mental burden you usually carry while reasoning about code in most languages. Purity is great not because you make fewer errors but because when writing pure code you can focus on what needs to happen instead of worrying about state/effects/control flow. While having to sprinkle `liftIO`s around your imperative code sounds dreadful, it's quickly appreciated as a statically checked marker for "code that you need to think harder about". So what you end up with is a fantastic playground to use mental tools unavailable in other languages due to the complexity overhead. You also have a suite of abstractions that "almost never break" due to their invariants being encoded into the type system and thus checked every single time you reload the file. People often compare this effect to having a large suite of automatically generated test specs run on every compile. It's like that, yeah, but humans can write tests this bulletproof and no suite runs this quickly. I get jitters writing Ruby sometimes now because I know I'm fallible and I have to store so much more in my mind in order to reason about it.
- egonschiele 13y agoAgreed. Ruby used to be my go-to scripting language but I've switched over to Haskell because it's much easier to reason about.
- malandrew 13y agoCan you give examples of the scripting tasks you've used Haskell for? Are they on your github?
- egonschiele 13y agoAll sorts of command line utilities. For example, here's a timer: https://gist.github.com/egonSchiele/6005209 https://gist.github.com/egonSchiele/6005209 Here's a script that emails me when someone follows/unfollows me on Github: https://gist.github.com/egonSchiele/6091917 https://gist.github.com/egonSchiele/6091917