Has anybody tried Haskell?

I was curious when mpjme (a youtube guy talking mainly about programming in JS) praised Haskell for learning/using functionnal programming.

Has any of you tried it ? What are your opinions ? How does it compare to vanilla JS ?

1 Like

https://xkcd.com/1312/ :joy:

Yes, Haskell is one of the more complete functional languages so you can certainly learn a lot about functional programming. However, to really make use of it you also need pretty good understanding of FP theory which may or may not be something you’re interested in learning. JS, by comparison, is maybe better considered as a language with functional features. Luckily, they chose the most useful features (like closures, lambdas, first-class functions and function chaining) which makes it a very practical language. Wikipedia has a pretty good [comparison of functional features] (https://en.wikipedia.org/wiki/Comparison_of_functional_programming_languages) between the major functional languages.

So the answer probably depends on how comfortable you are with FP in JS. If you think you understand it pretty deeply then by all means start looking at the ‘purer’ FP languages. (A good litmus test might be Eric Elliot’s excellent two-part post [The Two Pillars of Javascript] (https://medium.com/javascript-scene/the-two-pillars-of-javascript-pt-2-functional-programming-a63aa53a41a4#.eexzwxzam)—if that all makes sense to you, you’re probably ready for more). But if not, you might as well stick with JS and keep learning functional techniques with that. There are plenty of good resources out there!

1 Like

Thank you, I might not be ready just yet :hushed:. I was just amazed by all the possibilities Haskell has (all thoses utilities functions) that vanilla JS lacks…

I like it’s syntax (it reminds me a bit of ruby). One thing I even not checked beforehand is that it can compile to JS, so it might be handy in the future!

I haven’t tried it yet, but I’ve met a few people (especially math-y people) who are pretty evangelical about it. Learn You A Haskell For Great Good has been strongly recommended to me and is free.

I’ve played around with Haskell a bit and found it very fun, however it can be quite jarring to wrap your head around because FP is so different from imperative programming. It’s still so foreign to me that many problems I would find ‘easy’ to think about in JS are very difficult in Haskell. However, this completely different paradigm is really fascinating and I feel like starting to use/understand it has made me an overall better programmer.

I’d echo @ArielLeslie’s recommendation of Learn You a Haskell for Great Good and let you know that Code Wars has Haskell challenges, so you can challenge yourself with real code challenges as you read through the core concepts in LYaHfGG, which helps enforce them.

1 Like

Yes, and my mind almost exploded, it isn’t that easy for me; I tried it because one of my teachers wrote his thesis about functional parsers or something like that, must recall I didn’t understand a single thing…

Thanks for the replies ! I think I’ll stay with javascript haha, Haskell does sounds powerful but it is quite complex too. I just with JS syntax had more in common with it !