6 ms·
What do you mean by "either do things the Haskell (way) or you don't do them"? Isn't that the same with every language? I still don't understand why people put
by marceloabsousa 7y ago
What do you mean by "either do things the Haskell (way) or you don't do them"? Isn't that the same with every language? I still don't understand why people put all sorts of unfair labels on Haskell. By labelling Haskell with "fun", we almost make it sound like it can't be used in production.
- Drakim 7y agoWhat I think he meant is more like "either do things the functional Haskell way or you don't do them", as in, there is no non-functional fallback or alternative in the language, which some functional languages have.
- kadoban 7y agoThere's escape hatches here and there. If you need imperative code, use IO or ST. If you need to debug output something, Debug.Trace. If you need to temporarily bypass purity there's unsafePerformIO and friends (or they can occasionally be used permanently if you do a lot of analysis I believe). It's a pretty practical language compared to its reputation.
- Koshkin 7y agoActually, someone said, “Haskell is the world’s best imperative programming language.”
- sullyj3 7y agoSomebody said it, but it's glib, and not particularly true. I believe it was a comment on do notation, the bind operation, and programmable semicolons. The customizability is definitely cool, but nobody could possibly argue that imperative programming in Haskell is ergonomic.
- sullyj3 7y agoSure, IO and ST are escape hatches, but they're not escape hatches that beginners struggling with the concept of a higher order function are going to be able to use.
- giantDinosaur 7y agoI imagined it was more in the sense of the 'Have fun implementing Quicksort!' variety, where you're fighting the language constructs, basically, to do what you want.
- tmountain 7y agoHaskell has a huge catalog of libraries you can reach for, so you don’t have to reinvent the wheel. That said, the Haskell way can seem very different than what you see in most languages. As an example, IO—or anything causing a side effect—has to happen in the IO Monad. There are good reasons for this, but it takes some getting used to.
- vkou 7y agoThe parent poster is not lamenting that Haskell lacks a trivial sorting function. They are lamenting that implementing a trivial sorting function in Haskell is difficult.
- tmountain 7y agoI disagree. quicksort [] = [] quicksort (x:xs) = let smallerSorted = quicksort [a | a <- xs, a <= x] biggerSorted = quicksort [a | a <- xs, a > x] in smallerSorted ++ [x] ++ biggerSorted
- magicalhippo 7y agoNot that I know any Haskell, but wouldn't smallerSorted already include x due to <= operator? edit: also, how is the pivot element selected there?
- zests 7y agoBoth of your questions have the same answer. (x:xs) means x is the first element and xs is the rest.
- lonelappde 7y agoFor 99% of programmers, Haskell can't be used in production.
- yakshaving_jgt 7y agoThis is nonsense.
- gtycomb 7y agoI wish I could give you a thumbs up for speaking plain truth here. Anyway programmers will find out for themselves how best to satisfy their customer need.