Live data from Hacker News

Why Haskell Is Worth Learning

spin.atomicobject.com

61–70 of 114 posts

Re: Why Haskell Is Worth Learning

#61
post #46
post #29

Earlier quoted context omitted.

Haskell is also very simple--not from an implementation standpoint but from a semantics standpoint. Having polymorphism with no sub-typing (and no casting) is conceptually simple and easy to work with. Parametric polymorphism (like Java's generics but simpler and less horrible) is actually an extremely simple concept. The difficulty comes from a) implementing it in a stupid way after the fact ( cough Java) or b) havi…

It is an issue of the language's qualities if it does not really make it easier to reason about code. I find reason to question the simplicity of something which is widely acknowledged to take a lot of time to learn, to be mind-bending, and which seems to be impossible to explain simply - without deep theoretical background, academic citations or oversimplifications acknowledged as misleading. I think it would be mat…

>It is an issue of the language's qualities if it does not really make it easier to reason about code.

The primary point of haskell is making it easier to reason about your code.

>I find reason to question the simplicity of something which is widely acknowledged to take a lot of time to learn, to be mind-bending, and which seems to be impossible to explain simply

It takes a long time to learn any programming language. You create an invalid comparison when you compare learning language X++ after already learning X to learning language Y++ without having learned language Y. Haskell only takes longer to learn if you compare it to learning a language that is virtually identical semantically to a language you already know. And I don't know why you think it is impossible to explain haskell simply, there's a reason everyone points to learnyouahaskell.com when people ask how to learn haskell.

>The virtues of survivors like C and LISP are not all "social issues".

How is lisp a "survivor" exactly? Haskell is more widely used than any lisp is.

Re: Why Haskell Is Worth Learning

#63
post #38
post #13

Earlier quoted context omitted.

"The skill of breaking down large functions into smaller simple functions is a common skill of programming and should be practiced in all languages (C, Java, Python, etc)" Haskell will show you that when you thought you broke your code down into small functions in those languages, you were wrong in ways you currently can't even see and they're still shot through with duplication and mixing of concerns. This is really…

Learning Haskell taught me that mutation and state are good things, present both in the fundamental nature of computers and the real world. Haskell's attempts to eliminate state entirely results in a profound increase in complexity. For me, learning Haskell was like visiting a third-world country: enlightening, very different, but ultimately I leave feeling very grateful that I'm not a permanent resident. All in all,…

It doesn't sound like you actually did learn haskell. Haskell does not in any way make any attempt to eliminate state, and the idea that it does is absurd. Why would the language ship with a module called "State" if it were trying to eliminate state?

Re: Why Haskell Is Worth Learning

#64
post #46
post #29

Earlier quoted context omitted.

Haskell is also very simple--not from an implementation standpoint but from a semantics standpoint. Having polymorphism with no sub-typing (and no casting) is conceptually simple and easy to work with. Parametric polymorphism (like Java's generics but simpler and less horrible) is actually an extremely simple concept. The difficulty comes from a) implementing it in a stupid way after the fact ( cough Java) or b) havi…

It is an issue of the language's qualities if it does not really make it easier to reason about code. I find reason to question the simplicity of something which is widely acknowledged to take a lot of time to learn, to be mind-bending, and which seems to be impossible to explain simply - without deep theoretical background, academic citations or oversimplifications acknowledged as misleading. I think it would be mat…

That's not fair. Remember how long it took to learn how to program for the first time? Haskell is so different from imperative programming you should approach it like that.

Re: Why Haskell Is Worth Learning

#65
post #38
post #13

Earlier quoted context omitted.

"The skill of breaking down large functions into smaller simple functions is a common skill of programming and should be practiced in all languages (C, Java, Python, etc)" Haskell will show you that when you thought you broke your code down into small functions in those languages, you were wrong in ways you currently can't even see and they're still shot through with duplication and mixing of concerns. This is really…

Learning Haskell taught me that mutation and state are good things, present both in the fundamental nature of computers and the real world. Haskell's attempts to eliminate state entirely results in a profound increase in complexity. For me, learning Haskell was like visiting a third-world country: enlightening, very different, but ultimately I leave feeling very grateful that I'm not a permanent resident. All in all,…

no state in haskell? not in my haskell. state is usually made explicit, yes. there is a state monad because of a reason...

Re: Why Haskell Is Worth Learning

#67
post #16

I was thinking about this the other day and I think it generalizes beyond any specific language. I'm pretty sure every time I have learned a new programming language I came away a better programmer. Different programming languages (and their standard libraries) suggest that you approach problems in different ways, and that has real cognitive benefits. I was actually trying to think if there was ever a case where I ha…

The point about learning Haskell in particular is that it's a way different different language. It's a single language that gives you exposure to a lot of new ideas: purity, laziness, modern type systems, functors, monads, monoids, etc.

All of these exist or can be implemented in other major functional languages.

Re: Why Haskell Is Worth Learning

#68
I love haskell but I wish there was less blogging about why everyone else should use it and more building things that will make people want to use it.

The community is extraordinarily friendly to beginners, as long as you only count how they interact with beginners. If you count having resources that allow beginners to figure something out without having to ask then they are extraordinarily unfriendly.

If I find a potentially interesting library on hackage I'm no longer surprised to find it has no documentation at all, certainly no usage documentation or explanation of what it actually does or what it should be used for. Just code and autogenerated API docs. I'm surprised if there is anything that would allow me to actually use it. I'm not often surprised this way.

That and the wild west, "not invented here", multiple incompatible implementations of new ideas used in different important libraries (iteratees at the moment).

Not trying to throw blame around of course, but people probably don't need your "I have a new metaphor for monads" blog post or an argument for why it's worth learning. People need more posts like the 24 Days of Hackage(http://ocharles.org.uk/blog/) series and the Real World Haskell book and they need some brave person to try and convince those amazing library developers to standardize on an imperfect solution a little sooner and for a little longer (only in public of course).

Re: Why Haskell Is Worth Learning

#69
post #54

Earlier quoted context omitted.

There's not much value in learning programming languages that are similar. If you learn Ruby, you already know pretty much everything there is to know about Python. If you learn Java, you already know much about C#. The only real value you can get out of learning new mainstream languages is from learning the architecture of popular libraries. Like when I was inspired a few years ago to do database migrations after I…

I agree that there is pedagogical value in forcing yourself to write programs using only immutable data structures, but I don't think it's a restraint we should impose on ourselves for real world day-to-day programming. You aren't "cheating" if you've evaluated several ways of writing a program and you really think mutable local state is the best way to do it. Also lazy data structures are built into many mainstream…

On immutable data structures, a language like Scala makes it really practical to use only immutable data structures in daily programming. My own code is full of immutable data-structures, except in instances in which I have to process stuff returned by Java libraries and even in those cases I wrap them in Scala's immutable interfaces (note, I'm talking about Scala and not Haskell only because it's the language I know).

The only problem is that many times you need mutable references to immutable data-structures, with no easy way out and this is where you can still have problems with side-effects and multi-threading. But dealing with such references is easier, because (a) you tend to do it less and less often and (b) you can use STM or just plain atomic references or @volatiles, as in many instances you need to just ensure the visibility of updates and you only really need locks only on writes. Also, I tend to encapsulate and hide really well pieces of code that deal with mutability.

A good standard library of immutable data-structures is very practical for day to day use. I wasn't talking about immutable data-structures though, as the data-structures themselves are only a small part of the puzzle. Much more difficult is to deal with inter-modules communications, processing streams of data, I/O and stuff like that. And that's also where things break and where I feel the urge to look for better techniques.

On lazy data structures, Python is an awful example.

Re: Why Haskell Is Worth Learning

#70
post #7

Earlier quoted context omitted.

At university the very first language we are taught is Haskell. Lots of people had never programmed before, in anything and everyone managed fine. Nothing scary at all, no need for an understanding of category theory or anything. Monads are (fairly) simple things that just have a really bad reputation, partly the fault of the haskell docs which make them seem complex. Firstly: Functors are things we can map over in a…

Monads are fairly easily expressed in mathematics but trying to explain them conversationally appears to be an exercise in futility. There are dozens or hundreds of these explanations on the Internet and haven't seen one that hasn't been declared so wrong by the ones-who-know. (edit: and I'm not one-who-knows but I'm pretty sure "side effects might happen here" falls in this category). Classes, objects, functions, an…

Classes and objects don't have this issue because there is no underlying formal definition for them. They're also less general. Most descriptions of basic OOP ideas are on the same level as "side effects might happen here"; there's just nobody to correct them and nothing to correct them against.

Don't get me started about pointers. They're at least as difficult to grasp for most beginners than monads ever were. Hell, people have days of trouble just with references as in Java!

Functions do have this issue, and most of what different languages call "functions" aren't. It's just that unlike monads, functions have entered the common mind and people talking about them informally far outnumber those interested in correctness. And many people have plenty of problems with things like higher-order functions.

Post reply on HN