Ask HN: What are specific tangible benefits of learning Haskell?

18 points by blackbook ↗ HN
I've worked in C/C++ for many years and recently started trying to learn Haskell. As many new people learning Haskell, I am running into issues with not just the quality of learning material but the general attitude of members of the Haskell community. For example, when asking for an explanation of a particular topic recently, I received a barrage of insults about how annoying it is for people to be asking such questions, short unhelpful answers without explanation, a near constant refrain of "ask this question on IRC" because apparently people cannot be bothered to answer questions outside of there, answers which do not actually answer the question raised, various forms of pats on the head and patronizing "You go ahead and think that, Timmy. You'll soon see how wrong you are" styled answers, etc., etc., etc. Some members of the community have been nice but the more abrasive members have left a sour taste in my mouth. Is anyone ready, willing, and able to provide clear and concise explanations of specific tangible benefits of learning Haskell? I've spent almost 6 months trying to learning the language and I really don't feel like wasting another 6 months if it's not worth the effort in the end. If making objectively verifiable arguments, like "functions are more concise", please provide proof of claim.

34 comments

[ 3.6 ms ] story [ 55.2 ms ] thread
http://www.paulgraham.com/know.html

Learning Haskell adds to the mass of things you know, and the volume of that mass determines the level of your general expertise.

You asked for tangible things, but it's harder to see what those may be. Perhaps your perception will be enhanced: perhaps you will better see and care about side-effects, opportunities for pure functions, etc.

I don't think any learning effort that leads to increased knowledge can be a waste of time.

In absolute terms, no, learning is never a waste of time. In a world with limited time, though, everything has its opportunity cost. The time spent learning A could have been spent learning any of B through Z.

So: "Is Haskell worth learning?" Yes, certainly. "Is learning Haskell the best use of my limited time for such activities?" That's a much harder question.

(And it doesn't have to be the best use of your time. It could be close enough that it's not worth the time looking for something better.)

I think the opportunity cost is meant to be weighed in any question of "is X worth it?"

That said, I appreciate your calling it out specifically (even if I'd have used other words), as that is absolutely the real question.

My answer, I'm sure you'd guess, is "yes" - but certainly I agree that it's harder than the same question but ignoring the costs :-P

Funny, I once asked the same question about pure mathematics, and got similar answers. In the end I decided pure math wasn't the best bang for buck in terms of benefit to humanity, and decided to work on other things.

When it comes to Haskell, there is a big problem that the people best qualified to speak on the matter have invested a lot of time in Haskell, and therefore are subject to biases associated with their investment in the field.

For one thing, I would ask what programs use Haskell. The only major project I'm aware of is xmonad. This should tell you something about how practical Haskell is.

On the other hand, you may learn something from Haskell. I studied Haskell because I believe there are much better languages out there, and in order to find them we need to understand and improve on the theoretically most advanced languages (i.e. dependently typed languages) and learning Haskell was the best starting point. If this is not your goal, I actually doubt another 6 months of Haskell will help your day to day programming.

Also, what have you managed to learn in the past 6 months? And how were you studying? I found Learn you a Haskell to be the best introduction.

I am confused. If you feel there are much better languages than Haskell, how would Haskell be the "theoretically most advanced language"?

As far as what I have learned and how I have been studying, I did try "Learn You a Haskell" but found its explanations inadequate and sometimes confusing. Searching the web, I find a number of people feeling the same. Meanwhile, I find a large number of people agreeing with your experience the text is the best introduction. I think the fact the supposed best text is utterly failing a sizable number of people also suggests how worthwhile Haskell might be.

> I think the fact the supposed best text is utterly failing a sizable number of people also suggests how worthwhile Haskell might be.

I think it says a lot more about the fact that learning (and, therefore, the best text for learning) is highly subjective than it does about the worth of Haskell.

I mean, how does the logic even work that leads from "some people think that this text is good for learning about X but I find it is 'inadequate and sometimes confusing' to me" to "X isn't generally worthwhile" even work?

> I mean, how does the logic even work that leads from "some people think that this text is good for learning about X but I find it is 'inadequate and sometimes confusing' to me" to "X isn't generally worthwhile" even work?

I'm pretty sure I did not make that particular claim. I have trouble learning from the supposed best text; others have trouble learning from the supposed best text; asking questions gets me treated with hostility and non-helpfulness. I want to know what I am going to get out of learning the language if I put additional time into it. If I am not going to get any more from Haskell beyond (a) what I already know in C/C++ and (b) the ability to put Haskell on a resume, the question of cost/benefit analysis arises quite quickly.

I actually found LYAH to be really good. I picked up on the basics of Haskell very quickly with it.

If you're comparing your progress to some of the more advanced programs out there, you'll certainly get demoralized. But if you're having trouble with just the stuff in LYAH, then maybe Haskell isn't your thing? 6 months is a good long time to spend on learning something, so I'm pretty sure your gut instinct knows what's best for you.

>I am confused. If you feel there are much better languages than Haskell, how would Haskell be the "theoretically most advanced language"?

Let me rephrase: I think that there are much better languages out there, that haven't been invented yet. The most theoretically advanced languages right now are dependently typed languages. Haskell isn't a dependently typed language, but learning Haskell is a necessary stepping stone to learning dependently typed languages.

Regarding LYAH, it's not really possible for me to comment given how little data I have. I know some CS courses for undergrads teach Haskell, I wonder what textbooks (if any) they use?

(comment deleted)
I don't think HN is the best forum for this kind of question.
Where would you suggest I ask?
You can try the /r/haskell subreddit. They'll have more detailed information there, and on the subreddit you can browse some of the topics and projects currently going on in the haskell world, which may give you a better idea of what haskell is capable of.

Also, if you haven't been getting traction with the #haskell IRC channel, try the #nothaskell channel. The title is a little confusing (it should be called something like #notjusthaskell), but they try to be more helpful there than the regular #haskell generally is.

You may also want to check out this recent post about the quality of various haskell resources: http://bitemyapp.com/posts/2014-12-31-functional-education.h...

I have seen the /r/haskell subreddit. I lurked there for a few of months and my overall impression of it unfortunately is a sizable portion of people on that subreddit treat others exactly in the way which I have been treated while trying to learn Haskell, which is quite a shame. :-(

Do you have nay experience with the #haskell-beginner channel and knowledge about the degree of helpfulness there compared to #nothaskell?

I will check out the link; thanks a bunch!

> I have seen the /r/haskell subreddit. I lurked there for a few of months and my overall impression of it unfortunately is a sizable portion of people on that subreddit treat others exactly in the way which I have been treated while trying to learn Haskell, which is quite a shame. :-(

If you could privately forward me links to some of the examples of behaviour that discouraged you I would appreciate it. I spend a lot of time on /r/haskell and am keen to keep it an encouraging place for new visitors.

My email address is here: http://web.jaguarpaw.co.uk/~tom/contact/

To me the value of Haskell comes from its being an extreme point in the language design space: that of a pure, lazy, strictly-typed language. I think that Haskell provides a very nice syntax and GHC a very nice implementation for exploring this extreme point. The primary benefit of this exploration is that it enriches our understanding as a community regarding language design and program design. I think that is a worthwhile enough contribution.

I think that Haskell's strangeness harms it in two ways. One it puts off people because the superficial strangeness takes some getting used to. More dangerously it makes a small fraction of Haskell programmers dangerously arrogant. They feel that just because they are now familiar with this strange jargon they have become superior to the users of other languages. Depending on temperament this turns them into snobs or evangelists.

I don't think there is any concrete evidence of Haskell's superiority as a practical tool. Programs like pandoc, darcs or xmonad are great but there is no proof (and as far as I know neither have their authors claimed) that they were easier to develop than comparable programs in imperative languages (TeX, git?).

Much better is the attitude of Haskell leaders like Simon Peyton Jones who present Haskell as a ongoing research project with its set of successes and unsolved problems: http://research.microsoft.com/en-us/um/people/simonpj/papers... http://research.microsoft.com/en-us/um/people/simonpj/papers...

So, the only tangible benefit you see is "it enriches our understanding as a community regarding language design and program design"? To be clear, when you say, "I think that is a worthwhile enough contribution," are you saying this benefit of enrichment is "worthwhile enough" to warrant learning it?
Yes to the first. For the second, it is worthwhile enough for some people and I think it is a net benefit to society. Whether it is worth your time depends on your tastes and priorities.
I too found learning Haskell difficult, because there is, or so it seems, quite a big hurdle to get over at the start.

But it turns out that you can live in the IO Monad and just write Haskell as if were a strongly-typed kind of Python, and quickly get to the point where you are doing something useful, and benefiting from the type system and lazy evaluation (e.g. being able to define an infinite list then just consume as much of it as you want) and the nice syntax for pattern matching, and so on. Then you can gradually add in more and more Haskell concepts as and when a) you feel ready and b) you encounter situations where they'd be useful.

Jumping straight in with monads is the wrong way to do it (and monads are actually easy if you let them sneak up on you rather than trying to chase them, like cats) and the monad tutorials you find on the web are all written by idiots who think they a lot cleverer than they are. Burrito Spacesuit guy, I'm looking at you.

So, are you saying there are no tangible benefits?
Not at all, there are loads, see for example http://donsbot.files.wordpress.com/2009/01/semicolon.pdf

What I'm saying is, don't let a minority of the community put you off. The "conventional wisdom" on how to learn Haskell, is wrong.

Thanks for the link. I see 5 benefits listed. Concise code; native code optimization (LLVM) and compilation; parallel and concurrent runtime; debuggers, profiling tools, refactoring, coverage, testing tools; library support, distribution mechanisms. With the exception of concise code, however, I think I get the rest with a combination of clang and a good static analyzer, no?
Perhaps you could elaborate a bit why you are interesting in learning Haskell?

I'm a Haskell newb as well (write apps in Java for daily living). I'm quite interested in theoritical CS, and that's what keep me pursuing Haskell.

If you ask me what specific benefits I get, then my answer is none. At least at the moment.

Could you elaborate a bit what you want to achieve by learning Haskell?

I'm a Haskell newb as well. Learning it because I'm interested in theoritical CS (category theory, type system, etc).

If you ask me do I have any benefits of learning Haskell, then my answer is no. At least for the moment. But that doesn't stop me from pursuing it.

Of course, your mileage my vary... :)

I am looking to write some scientific programs in which I have a good degree of confidence is accurate and are easily understandable, maintainable, and extendible. Speed, in terms of both writing the programs and running them, is also a factor. Theoretically, I can write these programs in just about any language. However, I get the impression Haskell can do all this in a well-balanced way. At the least, I hear claims of such.
There are two languages that more than anything changed how I thought about programming.

The first is Lisp.

The second is Haskell.

Lisp taught me, essentially, that most of what I'd been doing in other languages was unnecessary tedium, and introduced me to the functional style for the first time.

Haskell taught me that even some of what I was doing in Lisp was itself unnecessary tedium, and that things like typing that I'd found tedious in other languages, could actually work to my benefit. Even though I still don't code in Haskell as my main language, it made a functional believer out of me, and still affects my coding style and the design projects I've done since.

As for 'objectively verifiable', well, go look at most any equivalent program in Haskell or Lisp to one in C or Python and just compare how many code lines it takes to do the same work. All the 'design patterns' and 'constructors' and costly looping constructs and everything else falls away for so much tedious bullshit when you get your hands on a language with proper functional tools. And the benefits to sanity of writing in a state-free style are literally the reason I left purely imperative languages behind.

Even the best, least tedious code I see in imperative languages usually comes from people who've had experience in functional languages: probably my favorite Python programmer to read is Peter Norvig, because his Lisp background shows through even in his Python code. This is why people say over and over again that, even if you never touch a functional language again, it's still good to learn at least one, because it will improve the way you code and how you think about functions and composition of same.

For me:

I can hack something together quickly cutting corners if needed, then refactoring is easy and almost always works on compile when you get around to fixing things up.

Here is a tangible benefit of learning Haskell which people agree on almost universally: learning Haskell will make you a better programmer even in other programming languages.

You will want to code using more elegant, more composeable and succinct, methods. You will want to break things down into small, provably correct units, and then combine them into larger solutions which take advantage of the proven correctness at the lower levels.

You will want to lean heavily on the type system and encode as many of your program constraints in there as possible, leaving your unit tests free to only deal with the logic of your code.

Even if you never write a piece of Haskell code again, you will find over time that more and more ideas from Haskell and similar languages are bleeding through into the languages you use. C++? Closures, optionals. C#? LINQ (monads). Obj-C? On the path to retirement, replaced with Swift. Java? Lambdas, optionals. Clojure? Typed Clojure. Scala? Scalaz. In fact, Swift? Swiftz. JavaScript? People are building entire functional languages (and reactive frameworks) on top of JS.

These things aren't happening by accident. Haskell is a fertile proving ground for the future of programming.

Spoiler: there aren't any. It's something hipsters, wannabe be mathematicians and idiots that haven't done any real programming like to circle jerk over. If you thought well designed classes were hard to understand and bloated than just wait until it's condensed into an ugly, undocumented, confusing set of alien hieroglyphics that denote instructions for a theoretical machine that doesn't resemble how modern computers actually work.
I recently spent a year and a half writing C. There were a couple points where, subjectively, it seemed that my Haskell experience suggested solutions that I would not have found otherwise. One in particular seemed to do quite a bit of heavy lifting over the course of the project. I've been meaning to put together a blog post but have several things above it in both my general "things to do" queue and my "blog posts to write" one.

I apologize on behalf of the Haskell community for any harsh treatment that wasn't deserved, and I wouldn't be surprised if there was some - the tone does seem to have shifted unfortunately.

What were the questions you had, and where did you ask them?

I lurk on #haskell-beginners, and things seem friendly there.