8 ms·
Haskell is fun, but bear in mind that it's followes a purely functional programming paradigm, meaning you either do things the Haskell or you don't do them :).
by Apollidore 7y ago
Haskell is fun, but bear in mind that it's followes a purely functional programming paradigm, meaning you either do things the Haskell or you don't do them :). But it's a fun language to learn, and there are lots of free quality ressources on the internet
- marceloabsousa 7y agoWhat 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.
- masklinn 7y ago> it's followes a purely functional programming paradigm I'd say that it's one take on that paradigm, the Way of Monads is not the only way to do purely functional, Clean uses uniqueness typing instead. Though it otherwise has rather similar properties to Haskell.
- deleted 7y ago[deleted]
- yeshengm 7y agoI'd say start with some eager functional language such as OCaml without the "object" part. Haskell code is hard to debug cuz you can't rely on good old print. Monad itself is never a silver bullet. Type systems and Composability are the true power of FP IMO.
- willtim 7y agoDebugging declarative code is always hard, whatever the language. Haskell does allow you to use trace expressions which will output values to standard out, see Debug.Trace. This is no reason to avoid arguably the most popular (and state-of-the-art) function language and implementation out there.
- marceloabsousa 7y agoI think we can all agree that debugging languages with lazy evaluation is specially hard. To effectively use Debug.Trace you actually need to add strictness and that can be fundamentally incompatible if you do intend to use the full power of lazy evaluation.
- lonelappde 7y agoDebug.Trace won't solve the space leaks lurking around every corner of your program, and won't shave the hundreds of megabytes to gigabytes of RAM the compiler needs for compiling a non trivial program with dependencies.
- fulafel 7y agoThough The Haskell Way includes the io monad, which is imperative code in practice :)