4 ms·
I 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
by tel 13y ago
I 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