A few months ago, I was asked to present an introduction to Haskell in a meetup to total non-Haskellers. The slides start with f x = x + 2 and go as far as defining a custom monadic control structure with the type IO (Maybe a) -> IO [a] that repeats an IO action until it returns Nothing and produces a list of the results collected on the way.
f x = x + 2
IO (Maybe a) -> IO [a]
When I made the slides, I tested them on a smart non-technical friend of mine (who had no experience of programming whatsoever). He was able to follow the slides pretty far into the presentation. I think the magic was equational reasoning. I could simply say, whenever f x is encountered, it’s replaced with x + 2, and apparently it felt very natural for him. You don’t have to talk about CPUs, memory, execution order etc. The concept of types also seemed very intuitive.
x + 2
So, IMHO, Haskell, as a language, is simple in the way that its foundations are close to our intuition, but the libraries (including Prelude) are very demanding due to the level of sophistication that can easily be expressed in Haskell. So you could say it’s not Haskell that’s hard to learn, but it’s the ideas that bounce around in the community. Delaying the digestion of those ideas is not an option either, since most libraries you need for practical purposes require a certain level of understanding of these concepts.
Haskell is hard when you come in with imperative assumptions.
I think it’s hard to understand what close does regardless of what assumptions you might have.
Ain’t nobody need to understand profunctors to use lens, let alone Haskell.
Live by cherry-picking, die by cherry-picking.
Obviously, my intention was to give an exaggerated example, I doubt you’ll find anything that goes into production with that level of abstraction in any other language. Although nowhere as abstract as profunctors, even prelude has its fair share of abstract concepts that would take some effort to understand. Something as common as traverse is well beyond what most programmers are used to. The thing is, when you talk to, say, Java people, they say things like, “When I was first learning Java, I had a hard time wrapping my head around the concept of classes”. But in Haskell, you probably make the same effort for each regular library construct.
This is utter nonsense designed to facilitate fear and encourage people not to learn. You shame yourself.
Something as common as traverse is well beyond what most programmers are used to.
You mean like for loops? Because that’s what Traversable is, a generalized for loop. You also don’t have to bloody use it if you don’t want. Write a loop by hand if you want!
But in Haskell, you probably make the same effort for each regular library construct.
Ehm, no, and most libraries you’d use for work are built on the same set of idioms. I have a coworker that’s used Haskell for 10 years, used it for work for 5, and he didn’t start using or understanding monad transformers until he worked with me. And that’s one of the most common intermediate concepts you’ll see in libraries. He was way happier and more productive in Haskell than he was in other languages just with basic, common idioms.
Bullshit like this is why I wonder if I should even bother trying to help programmers and instead focus more on replacement.
What a terrible attitude. BTW, it’s a really bad habit to downvote someone you subjectively disagree with. It has terrible consequences for a community, because it leads to mob justice, and any unconventional opinion gets suppressed. The fundamental point is that ideas are not democratic. Anyway, I’ll stop arguing with you, since I don’t have to put up with your lack of manners.
I’d save your time and move on, the old joke about wrestling with a pig etc. Variants of something like this thread basically recur over a period of years on this site.
It’s sad that this’s been going on for years, especially so since the user in question is clearly a valuable member of the community (ignoring his attitude obviously).
it’s a really bad habit to downvote someone you subjectively disagree with.
We literally have a downvote flag for incorrect. Highlighting a specific challenging thing in the discussion of “haskell is hard?” is intellectually dishonest. It’s like saying, oh OOP is hard because there’s IOC. It’s not a subjective disagreement, your point is dishonest and incorrect in the context of this discussion.
The key point here is subjective disagreement. I’m not saying my opinion is worth a dime, but every opinion in history that changed people’s point of view started out being disagreed by everyone. If you disagree with me, explain why, and people upvoting your comment will imply collective disagreement with me. Because downvoting doesn’t mean disagreement, it means “I want this opinion to be hidden from others”, and it’s only justifiable if you can show that the opinion can be objectively shown to be incorrect.
Then the question is whether I was being dishonest: I mentioned traverse which is a pretty commonly used function from Prelude and it’s definitely quite abstract compared to what programmers usually use. Consider how long it took for imperative programmers to start using higher-order functions like map and reduce. Now consider that traverse is parameterized over a notion of computation!
You may disagree with my assessment of how abstract traverse is or how commonly used it is, but you can’t say it’s dishonest, let alone factually incorrect.
Do you seriously believe that of what you just said? You’re punching down and I’m dunking on you for it.
The fundamental point is that ideas are not democratic.
Think about what this says about your extremely basic and common opinion. Take a gander through these threads: https://www.reddit.com/r/programming/search?q=Haskell&restrict_sr=on
You are the mob.
Anyway, I’ll stop arguing with you, since I don’t have to put up with your lack of manners.
Cut the bullshit and we won’t have to repeat this exercise.
Do you realize your attitude would drive more people away from Haskell than any (mis?)conception about Haskell’s difficulty ever could? One of the things I brag the most about when I’m evangelizing Haskell is how its reddit community is exceptional in its etiquette. It’s one of the very few communities where you can see two fundamentally opposing opinions receiving high points, because people realize it’s not a pissing contest.
Think about what this says about your extremely basic and common opinion
My opinion in this particular instance is irrelevant to what I’m trying to tell you about downvoting people, but clearly there’s no point in arguing with you.
I was wondering when we’d get to tone-policing.
Don’t be offensive, don’t get an offensive response.
One of the things I brag the most about when I’m evangelizing Haskell is how its reddit community is exceptional in its etiquette.
Okay, your FUD show on the road and see how it plays in /r/haskell then.
Who do you think you really are? Are you really this detached from social norms?
Who do you think you really are?
Someone calling out a liar that said he was done with this conversation but has shifted into ego defense and tone policing.
Are you really this detached from social norms?
Social norms are no shield for people that lie in order to peddle fear. I will be perfectly amicable the next time we encounter each other as long as you aren’t doing this again.
people that lie in order to peddle fear
Please read through our conversation again, and re-evaluate whether I was in a campaign to detract people from Haskell. You might disagree with my opinions, but my (ill executed or not) intention should be clear. If I were trying to drive people away from Haskell, I’d be doing a terrible job, because this is lobste.rs, I don’t think people here will be driven away from a language because it lets people express abstract concepts easily.
I never implied Haskell was hard, it’s programming that’s hard, it’s just that Haskell’s type system lets you express the exact complexity of your solution, whereas an imperative language could give you the false confidence that you understand what’s going on while trying to follow the logic in some ad-hoc event handler in some imperative spaghetti.
I agree that even if you’re great with profunctors it still takes a while to understand Close and Closure. I’m missing what relevance it has on the “Haskell is hard when…” statement though.
You’re absolutely right, my comment is entirely irrelevant to the statement “Haskell is hard when…” itself, but I (quite possibly wrongly) assumed that the intended meaning of the statement is “Haskell is easy when not …”. Then I think it’s relevant. But without that assumption, it’s indeed quite stupid to make that comment :)
So are a bunch of OOP design patterns. Advanced things are advanced, go figure. The only thing that makes Monads Functors Applicatives Profunctors etc harder is that they use math words which are very precise to describe the things. You don’t need to understand how to build an engine to drive a car. You also don’t need to use a mechanical engineer’s words if you do decide to build a car. I have had no issue sharing functional style with noobs, but I was trying to remark on the fact that OO programmers have a much harder time adjusting than those with no experience whatsoever.
I partially agree with you, but there’s an important distinction between OOP design patterns and Monads etc.. In OOP, you don’t see libraries that define a natural transformation between design patterns, say, you pass in a design pattern transformer pattern as a first-class value and it returns another transformer for another kind of pattern. This is exactly what happens in Haskell, and it makes the language extremely powerful while also making libraries that expose such APIs mentally demanding. Here’s a practical example from Servant which demonstrates exactly what I’m talking about.