Hacker News new | ask | show | jobs
by amazing_jose 4093 days ago
I loved Haskell, seriously!

The year was 1997 and my uni professor was contributing to Hugs (do you remember it?). But, while I was working my way through Monads and stuff other people were running circles around me in C or C++. The basics were "simple" (even for basic C++) and they concentrated in getting things done.

Years later I launched my first start-up idea on Common Lisp. In both situation I learnt two hard truths:

a) libraries and support are very important

b) Architecture + basics >>>>> any particular technology

Now we are in 2015 (nearly 20 years later) and Haskell has advanced as much as Common Lisp on regards of usefulness for the general business. People still consider them elite (or 1337!) languages for showing off, meanwhile the rest of the world (with its mediocre programmers and tools) are running circles again. Programs now are distributed around dozens, hundreds or thousands of machines. Latency, networks, deployments, services, data communication,...

In the end I selected Python as my main programming language, following Norvig's advice that Python made for a good replacement for Lisp. I don't regret my decision not even a bit. Python paid/pays my bills. Yet, from time to time I read this posts and presentations and I feel a bit of envy for not being in a position where I could say «I reject your reality and substitute my own» and use Haskell or Common Lisp for main infrastructure to have the 1337 feeling again... like when I use obscure operative systems and end up in fruitless battles over how they are better even taking into account the lack of mainstream adoption (I'm staring at you Haiku-os!).

3 comments

I really could not have said it better. Programmers seem much more likely to feel the need to prove they are smarter than their peers than the average population and functional languages seem to be a very popular I'm-smarter-than-you badge to bandy about.

I think the penetration of functional programming speaks for itself. If a tool is clearly superior, you'd expect it to do great things, and to do it often. I hear tons of excuses but not one that has made any sense.

To be clear, I'm not say functional languages are worthless, I am succinctly saying that they are not measurably more productive than the usual suspects and I say this after having a rather pleasant experience with erlang working on a rather huge ejabberd plugin.

Going philosophical (and I do this a lot), it's really about exploration of the solutions space. I think the whole profession has moved a step forward and we need metaphors, tools and architectures for systems where one computer (regardless of the number of CPUs or architecture) is just a component in our systems. Functional programming (not Functional design, think Map/Reduce) is a late attempt to improve on a "semi-solved" problem: to produce high quality systems that run inside a unique computer. Late attempts always can contribute, but they only offer some negligible benefits that doesn't balance properly with the added complexity (in technology or training... the famous learning curve). These attempts will always be welcome and will improve some layers on the systems we design, it's just that as move forward the benefits will go into a diminished returns dynamic.
Hm, I'm not sure about the parallels between Lisp and Haskell, and the conclusion that they are primarily valued for showing off. Yes, they are appealing to programmers with that mentality because they are powerful languages that are difficult to learn and use effectively. However beyond that they diverge dramatically.

Lisp is a language with no syntax, it is like an unshaped lump of clay. It gives you total freedom to implement any computational construct you can imagine. This does allow greater productivity for very small teams, and maybe it's the most powerful tool for the smartest programmer, however it doesn't offer anything to improve the practice of maintenance and reuse. This is why no viable ecosystem ever coalesced around Lisp, and in fact why there are so bloody many Lisps to begin with: because it is attractive primarily to individuals who want to build their own special flower.

Haskell gains its power in an almost opposite way by its type system, it's an extremely rigid structure which contributes tremendously to code reuse and maintainability. It works because great effort was put into the type inference so that it is strong yet lightweight.

IMHO as a seasoned programmer who has spent 5+ years and 7+ years on individual projects, I can definitely see that Haskell is addressing real world problems in a way that Lisp can not. I use ruby day to day, and frankly it's good enough in its meta-programming ability to solve most of the pain that Lisp solves compared to say Java or C++. However when I look at the problems which creep in over a period of years, the code rot, these are things which Haskell trivially prevents while half-hearted type systems like Java don't really put a dent in.

I think the reason Haskell hasn't seen more adoption is simply because of the current value of shipping fast. However we are in the midst of a Cambrian Explosion of software, and I believe that as the maintenance costs become apparent (as well as parallelization increasing), that the scales will tip towards many functional programming ideas. Maybe it won't be Haskell that sees mainstream adoption, but at the moment it has the most powerful embodiment of these ideas. I wouldn't bet against it based on the parable of Lisp.

I'm shocked by your comment.

Lisp was a language that precisely gained great adoption due to the power it allowed to the individual programmer. The lack of syntax was it's biggest advantage.

Viable ecosystems coalesced around Lisp! Emacs? Lisp Machines? Tons of scientific software? Big AI projects? The whole open source revolution started due to the appeal of the commercial world for Lisp and it's success.

Lisp was a academic and commercial success. The reasons for its decline are multiple, and yet it even was able to come back as Clojure.

And then you have Haskell. A programming language created exclusively by and for the academia. I don't know if you realise that Paul Graham launched his startup using Common Lisp... at a time when Haskell was available as open source too. I'm just using Paul's name as an example of the large community of people who thought (and think) that Lisp languages gave them a productivity and power that couldn't be compared. You even have some commercial video games programmed in Lisp languages! (the famous and repeated example of Naughty Dog). Lisp in finances? Yeap, there are still system using it after many years. Remote probes in deep space? Check. So there must be something to Lisp that helped people to create reusable and maintainable code. And in all these cases it was individual geniouses who pushed for the use of Lisp.

I think that the problem with Haskell is the single promise of its type system. Every single language that boasts to have the silver bullet that will allow people to tame programming (what is nothing more than hard complicated work) has failed to gain adoption by some reason. Diminished returns, maybe. The world is complicated and single techniques that promise to solve everything tend to fall short to the promised benefits. So, how is Haskell going to help me with network protocols? To build better generic software? To interface with the IoT? To create better AI or explore data with Machine Learning? If the answer to these and other questions is "through a hard fully capable type system", then I cannot but laugh.

Then you have languages like R, that are gaining wild adoption in the academia (even if it's a "specific" language) because people feel powerful with them. They can achieve so much more with the same effort that it's a no brainer to use it. Code reuse? Yeah!!!! Thousands of libraries available that work like a charm. Ugly? As hell! but who cares? Oh yes, dogmatic showing-off aestetically/academic inclined posh programmers that represent a small part of the industry, they seem to care a lot (I include myself in this group). And yet smart people is using R every day to the point of forcing people like me (yes I programmed in Haskell in the past) to recognise that there must be something to it. A programming language that transfer a unseen amount of power to the normal user (even if it's an opensource copy of previous software).

As I said, I would like to be able to use the «I reject your reality and substitute my own» card... but after that many years I think that doing so would be just plain naîve.

PD: I would never put maintainability above power (power being defined as "now I can do X easily in half the time"), it seems to never work when it's achieved through "training" and "complexity" (as in for instance "large learning curve").

You're right, I was downplaying Lisp's successes. In fact I wouldn't disagree with most of what you say here, Lisp is definitely more powerful than Haskell.

The part where I disagree is that Lisp holds future promise as a general-purpose language replacement to tame the mess of COBOL / C++ / Java / PHP. I see in Haskell a way to raise the bar for the masses, whether it's Haskell per se or some trickle down effect. Yes, you could build a powerful type system in Lisp, but it is not a widespread goal because it is somewhat conflicting with the raw power argument.

> I would never put maintainability above power

Here is another place I disagree. All else being equal of course I prefer power, but these things are on a continuum. If I can sacrifice a bit of power to greatly increase maintainability or robustness then I believe that is a compromise worth looking at.

I'm curious if you really see no truth in my comment or you really do see programming world in purely blub-theory terms.

So why are you using Python now and not C/C++?
Balance, c/c++ (and even to some extend Java), are not appropriated for what I normally build: web systems. The balance that Python offers me, where performance is achieved by other means than the programming language (systems), with an access to libraries (data analytics, web frameworks, devops...) that cannot be easily matched by C/C++/Java. And about Haskell... well, I suppose it offers amazing performance and technical advantages over other languages (if I remember...), but always as far as you can afford little geniuses working in specific problems in a megacorp where all the other things (from having access to cash, to sending them to Hawaii with all the family every year, to SRE, to Devops, to... well everything) has been covered and what you really need is that 0.00001% of advantage that can keep you in the competition with other megacorps (Google vs Facebook?).

Sorry for my "you geniuses are important but not that much" approach, but I'm in the start-up business, not in a PhD ridden competition to check who can move more chess movements in their head while listening to trash metal :)

If you want to know my thinking framework for this kind of stuff, I apply Dawkins/Evolutionary Biology technique of counting how many times certain traits have evolved independently to measure its usefulness. Take any Haskell project in Google and measure it vs their total code vs the revenue that it brings to the table. Same for Facebook. And then we can talk.

And yes, I realise that Facebook is mostly PHP and Google is mostly C++/Java. But I remember, the first engine in Google was implemented (at least in part) in Python ;) Later they had the cash/resources to afford rewrites in C++/Java.

But that was the point, that not all programming languages are created equal. I only have anecdotal and personal experience to back this up, but I believe that a vast majority of people familiar with both Python and C would much prefer the former for Web development (as you do).

Looking at the big picture, computers are so ubiquitous now because they provide significantly better tools for all kinds of businesses. It's fairly obvious that programmers themselves can also benefit from improved tools. And our main tools are programming languages - although there are obviously also other parts to the puzzle (IDEs, compilers, build + deployment + CI systems). I think we are already better in that some of our mainstream languages today are nicer to use than most of those 30 years ago. However, the difference is not huge, and my impression is that the language development was largely done from personal experience of individual language creators, and has largely ignored the research advances made in the area of programming languages. Notable exceptions are garbage collection, and Clojure and Haskell (if we can consider them mainstream).

Now of course, there are other, both non-technical considerations that are also affected by language choice. Availability of libraries or programmers are obvious examples. But the real question is of course whether incorporating these advancements offers a real, measurable benefit, and I think that's what you're hinting at. The problem is that the benefits are hard to measure in a sensible way. Frankly, I don't think that the metric you propose (which, if I understand correctly, is "measure the cost/revenue ratio of projects in language X at company Y against the average ratio for all projects at company Y) can give reliable answers. How do you measure the revenue of something like Haxl? I think the language choice is going to remain a personal decision in the end.

> the first engine in Google was implemented (at least in part) in Python ;) Later they had the cash/resources to afford rewrites in C++/Java.

It seems Larry Page started trying to write it in Java then gave up and switched to Python for version one. Guess Python's easier, Java runs faster.

http://carlcheo.com/fascinating-posts-from-tech-founders-who...