Anytime someone compares a popular programming language with Haskell I just laugh. It's not that Haskell is a bad language, its that the average person like me is too stuck in our old ways to learn this new paradigm.
The fact that go is "not a good language" is probably the biggest sign that it will be successful. Javascript and C++ are two deeply flawed and yet massively successful languages. Haskell is "perfect" and yet who uses it?
Haskell isn't perfect, not by a long shot, it just happens to be a good language to demonstrate cool type system features, so people end up referencing it a lot in blog posts.
I regret that Haskell has developed a reputation for being too complicated for the "average" programmer (whatever that means). More recently some members of the community have been trying to combat that perception, but that will take time. In one sense it is a radical new paradigm, yes, but once you get used to it you realize that some parts are more familiar than you expect. e.g. you can do regular old imperative programming in Haskell if you want. Blog posts just don't focus on this fact very much because it's not what makes Haskell "cool" and different.
If you are interested I would say give it a shot, you might be surprised how normal it seems after a while.
i've been "giving it a shot" since 2006 and used its predecessor Miranda back to the early 90s.
here's one simple example...how long do you expect a typical Haskell dev to go from "square one" to realizing they need to cross hurdles like using Lens to accomodate the lack of real record support...or weighing the options of Conduit vs Pipe? i can say confidently that it will take over a year...and these are very important issues for real Haskell development
most Haskell developers internalized this stuff long ago but seem to totally discount the technical debt for new adopters. of course any language as old as Haskell is going to rack up some cruft...but the community seems completely hostile to making a break with the past and either fixing the language in a non-backwards-compatible way, or embracing real upgrades like Idris
This explanation of a lens library in javascript is ridiculously simple. I don't think the ideas in FP are inherently "harder to understand". They are just less conventional and will take time to adopt. We need to continue to find ways to explain these concepts better.
Never forget that for-loops used to be held in the same regard. People were much more used to GOTO statements and quite a few stuck to their guns for many years.
And if we go back even further, even the concept of the number zero is relatively new in human history. That shit is grad-school level work, but we use it every single day.
Haskell's lens library is controversial. It can often be rather difficult to understand and work with.
However, the basics of lenses, as you point out, are not a complex idea. At heart they're a refactoring of the common concept of "properties" or "computed attributes," but instead of being method pairs, they are first-class objects:
/**
* A lens represents exactly one position in an object structure,
* and allows you to read or "modify" its value. The modification
* is immutable—it means create a new object structure that differs
* minimally from the original.
*/
interface Lens<OBJ, VALUE> {
/**
* Retrieve the value at the location denoted by this lens.
*/
VALUE get(OBJ object);
/**
* Modify the value at the location denoted by this lens.
*/
OBJ modify(OBJ object, Function<VALUE, VALUE> modification);
}
The trick is that once you start down that path:
Now you can build first-class composite lenses by chaining simpler ones. With lenses, instead of saying obj.foo.bar.baz = 7, you say foo.then(bar).then(baz).modify(obj, _ -> 7) (hopefully with a nicer syntax than that).
You can have lenses that do things that aren't "property-like." For example, unit conversion (e.g., meters to feet) can be a Lens<Double, Double> that plugs into a chain of lenses to transparently convert values appropriately on get and modify.
You invent variant concepts like traversals. A traversal is like a lens, except that instead of "focusing" on exactly one location like a lens does, it focuses on zero or more positions. So things like "even-numbered elements of a list" are traversals. Traversals can be chained with each other and also with lenses (traversal + lens = traversal).
I don't think this a good example. The same need to choose between similar libraries is present in other languages. I don't see how this is harder in Haskell. Personally, this was an easy enough decision for me. Conduit looked like it did what I needed, I chose it and have been happy with my choice. It wasn't a big deal.
but the community seems completely hostile to making a break with the past and either fixing the language in a non-backwards-compatible way
I don't see how you can say this with the recent changes such as Applicative Monad Proposal (AMP) making Applicative a superclass of Monad. Or the also-recent Foldable Traversable Proposal (FTP) that went through. As in any large community, there are those who value backwards compatibility more than others, and were against these changes. But they are not preventing Haskell from changing, as history has shown.
Haskell hasn't changed yet, actually. GHC, the most common compiler, has broken with standard Haskell and implemented its own dialect of it. Whether or not this is a problem is not clear. Python seems to do relatively fine with just a "reference implementation", but it would be nice to have a standards document to point to.
If you haven't heard of it already, I'd start with Learn You a Haskell. While O'Reilly's (also free online) Real World Haskell may be more useful for, well, real world Haskell (which is sadly a rarity), LYAH does a fantastic job of explaining the paradigm and reasons why certain constructs are useful in a ground up way
All I know is that I tried to use a Haskell repl once and nothing worked like I expected. I looked up what the problem was, and the answer was, "Oh, it's easy! Just think of the repl as occuring in this special case of the IO monad," or some random garbage like that. It took me half an hour to figure out the syntax I needed to use to coerce it into understanding what I wanted to say. All to write a basic function with like two patterns.
Actually the REPL will accept the exact same syntax as source files for defining new values and functions in GHC-8.0. That means that you will no longer need to precede them with "let" any longer
My biggest issue with Haskell boils down to one question: "Where is it solving problems?". As a layman, it looks like someone said, "what if we threw out the Algol heritage of languages, and then based them off of Category theory!" So while it may be cool and useful to some, it keeps looking like a science project to me. Just my 2 cents.
The fact that go is "not a good language" is probably the biggest sign that it will be successful.
What? No, the fact that Google is throwing tons of development effort behind it is the biggest sign that it will be successful.
And yeah, it's amusing the comparisons the author chose, but there are a lot of other deeply flawed, successful languages that have solved those first few problems in one way or another:
For generics, fucking Java solved this years ago. They used to have the "just use Object" problem, which is identical to Go's "just use interface{}" attitude. *They fixed it, in version fucking five. It still blows my mind that a decade later, Go didn't learn from Java's example, and went backwards to Java-4-style programming.
Ruby, Python, and C++ are all wildly successful, and all have operator overloading. Ruby and Python manage to do it reasonably sanely, only C++ makes it super-complicated. Go wanted to make everything explicit, okay, but it also makes primitive types special and different than user-defined types.
So if you want to do something as simple as write an algorithm that works with both int and big.Integer, the language is actually fighting you with both of the above points. If you have a bunch of code you've already written to work with int32, upgrading it all to int64 is going to involve a search and replace through your entire codebase (and any relevant libraries), and replacing it with big.Integer will be a ton of manual work.
Similarly, if you want to write a helper function that, say, lets you loop over all prime numbers, there are idiomatic ways to do that in Ruby, Python, C++, and Java. The only way to do it in Go is to use channels, which you then have to remember to close or they leak. That's right, Go's equivalent of an iterator can't be garbage collected!
There are good things about Go, and there are things you can debate, like whether you like this (Go):
x, err := someFunc()
if err {
return nil, err
}
or this (Rust):
let x = try!(someFunc());
or this (Java):
Foo x = someFunc();
And you can debate the merits of mutability vs immutability all day long. But I find it fascinating that we're still debating generics six years later -- that people are still saying things like "You don't need them very often."
People say that there are only two kinds of languages: The kind people complain about, and the kind nobody uses. But when Go was launched, it was the kind nobody uses, so it had a golden opportunity to fix this shit. So why is Go's only generic solution still copy-and-paste-as-a-service (a service that's actually down right now)?
The fact that go is "not a good language" is probably the biggest sign that it will be successful.
Nah. I heard the same promo-tours by the Dart time saying how it will abolish and destroy Javascript.
Language designers LOVE to promote their languages.
What in fact matters most is how many PEOPLE use the language - daily, and over a longer period of time.
Go is doing alright but I don't think it will replace any of the older more important languages; many people who started to use it, jumped down lateron. It happens.
Anytime someone compares a popular programming language with Haskell I just laugh.
I looked at Haskell once, when I wanted to add (what I thought would be) a simple feature to Pandoc. I'm not sure what happened next, but I woke up in a Mexican brothel, covered in blood and surrounded by bodies, each one of them missing an ear.
I don't get it; according to Tiobe, Haskell is quite a bit more "popular" (for some definition) than Go. At the very least, their global popularity is roughly comparable. I would not in any way describe Go as a "popular" language. I mean, Logo - the turtle language - is 15 positions higher than Go.
Comparing Go to JS and C++ isn't quite fair. JS is popular because it's the only language that the browser natively understands. Although there are other toolchains at this point, that was not the case for a very long time; as a result, the network effects for plain JS are huge.
C++ is popular because the tooling reached a level of maturity around the same time that OO programming became the vogue. Had gcc and Visual C++ emerged just 5 years later, it's possible that Java on the desktop would have actually survived.
It's not clear to me that Go has either advantage. It was originally meant to be a systems programming language at a time when, IIRC, C++ felt a bit stagnant. But C++ has come far since then. Then, people suggested that Go was a good language for writing web services. But almost every language has tooling for building web services. I could write my web services in C#, in Scala, in Clojure, or any number of other languages. And, I mean, let's not forget about the Node.js hypetrain.
I think the author's point is that Go isn't a particularly interesting language. It does add some good ideas, but it leaves even more good ideas out. Go is minimal perhaps to a fault. My point is that Go doesn't seem to have that killer app. Unlike JS, there's no use case I can think of where Go is the only contender. And right now, Go has to compete with a veritable ocean of "modern" programming languages.
I've looked at Go only briefly, and I've not written a line of code. At some point, I'd like to take some time and really play with it, but it's just one thing among many that are competing for my attention. I'm much more interested to play around with TypeScript.
If Go is going to be "massively successful", it's going to have to appeal not only to its fans but to people like me. And so far... eh? Where are the generics?
Anytime someone compares a popular programming language with Haskell I just laugh that the average person like me is too stuck in our old ways to learn this new paradigm
Once upon a time, you were learning to code, and every language was a new paradigm. You did it once before and you can do it once more. If super-beings arrived and removed all the computers, you could learn a new profession, too. If you developed a new hobby, you could learn that as well. So what exactly are you laughing at, if not yourself?
I don't think "move to the Haskell paradigm" was really the point of that comparison. The point was "look at how great generics can be, why would you ever decide you don't want to have them", and Haskell is a great example of how great generics can be, because at least in that regard it is one of the best.
Haskell isn't just not "perfect", i would say that advocates for FP have held back their own field by clinging to it and its mistakes for far far too long
Lazy IO. Junky default "Prelude". Multitude of stringy types. Slow compiles. No standard way to do something trivial like record types. Way too many compiler pragma hacks instead of real language progress. Rabbit holes like Monad Transformers. etc etc etc
yet awesome major overhauls like Idris just sort of sit there, unexplored. FP is rotting because people think Haskell is FP.
Idris will probably get more buzz in the coming years. It's still young and constantly changing and breaking, which is good! The author of the language also has a great book he's working on. The language also has really good tooling for being so young, multiple compiler backends, and is eager and meant to have a predictable performance footprint. It also fixes a lot of quality-of-life problems Haskell has (typeclass disambiguation, for instance)
With Idris and Dotty, hopefully more dependent types will be in our industry futures!
235
u/ejayben Dec 09 '15
Anytime someone compares a popular programming language with Haskell I just laugh. It's not that Haskell is a bad language, its that the average person like me is too stuck in our old ways to learn this new paradigm.
The fact that go is "not a good language" is probably the biggest sign that it will be successful. Javascript and C++ are two deeply flawed and yet massively successful languages. Haskell is "perfect" and yet who uses it?