137 points · by lelf · 11y ago · 120 comments
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!).
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.
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.
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").
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.
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.
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.
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...
The biggest FP project I was aware of was Twitter using Scala and they ended up completely backing away from it. Yikes.
The only other popular site that springs to mind is Hacker News, and frankly, it sucks. It's practically the Hello World of discussion forums.
The truth is, at the end of the day almost everything is being built with Java, Python, Ruby, or JavaScript. Can you really blame the product owners for being wary of writing their whole product in a functional language?
How about Erlang. Let's try it, just from the top of my head:
* AXD 301 Switch -- Classic. Powers and control phone switch networks of whole countries. Claims 99.9999999% reliability.
* Basho Riak -- popular NoSQL database, highly scalable nodes are peers
* RabbitMQ -- popular message queue used by enterprises
* WhatsApp -- messaging application, processes billions of messages a day. Built and maintained by only a few engineers. Sold for billions of dollars.
* Klarna -- European payment processing
* Bet365 -- Sports bets
* Stock trading -- Allegedly Goldman Sachs uses it.
* Erlyvideo.org -- Video streaming service
* eNodeB -- Ericsson cell to internet gateway. There is a 50% if you want to look at cat pictures from your smartphone and Erlang breaks, you won't see your cat pictures.
* Wings3D -- A subdivision 3D modeler. I guess you can build your 3D cat and then send it over WhatsApp via a eNodeB to your friend.
Those are just I know of. So there you go. Maybe you should learn Erlang ;-)
Erlang isn' purely functional language in the same sense as Haskell is. It's much more mainstream compared to it.
Clojure has even less of it. It's basically LISP which is about 60 years old.
But you make an interesting point in a way. One can ask, ok here are two non-strictly functional languages that seem to be fairly practical. Used for large distributed mission critical systems.
Would they be better off written in Haskell?
Would they have been written at all if creators only knew about Haskell?
How large is the relationship between fault tolerant and safe systems as a product vs strong compiler type safety in the language it was written.
Allegedly, Goldman also uses Excel spreadsheet macros. I wouldn't use the Goldman one.
As for Hacker News UX I wish every site was this simple instead of popups everywhere to get me to download their phone app, piles of slow loading fonts, trackers, generic stock images of business suits pointing at a screen, information buried underneath annoying popup FAQ screens, ect.
You need to normalize against the number of programmers writing in Java/Python/... compared to the number of programmers writing Haskell for this assertion to be meaningful. And when you do that, the picture starts to look a lot better.
In the past few years I have seen more and more people start writing real projects in Haskell and be successful. There was a presentation a couple years ago at CUFP [1] discussing one company's experience porting a 43k line Groovy app to 8200 lines of Haskell. You don't need someone to build a highly visible multi-million line piece of software in Haskell to be confident that it can benefit your project. I think there's enough evidence out there today to make a very compelling case.
Now what percentage of the non-functional ones ends up becoming successful enough for you to hear about them and know what they were built with? Apply that percentage to the functional projects, you might just be left with naught.
I have a feeling that if there's one thing more rare than functional programs, it's highly successful ones.
However, to be productive, you're usually constrained by what the dominant language is for your domain. For example, Android apps are usually written in Java and web apps are usually written in JavaScript. Each has a huge ecosystem of tools and libraries based around these languages.
I'm sure there's some way I could use Haskell or OCaml to write Android and web apps. However, by going against the grain, it's likely to be very time consuming and frustrating to integrate with existing libraries and tools. I'm therefore going to lose any advantage I was hoping to gain from using a functional language.
I don't know about Android, but for Javascript apps the balance tipped for me just last month. I'm probably enough of an insider that it's not quite true yet for the average Haskell developer, but I believe that will change soon.
For the code running on the server side, you are free to use whatever you want. Are you using strongly typed FP there?
What are you talking about, I just searched and found zero supporting sources
https://www.redfin.com/devblog/2010/05/how_and_why_twitter_u...
http://readwrite.com/2011/07/06/twitter-java-scala
http://www.slideshare.net/al3x/the-how-and-why-of-scala-at-t...
That said, you do have a valid point: The presentation provides justifications for those that want to switch in the first place, but to be compelling, it needs evidence.
You must be joking, Twitter is far and away the largest Scala shop in the world.
Presumably you're mixing up LinkedIn's recent move from Scala to Java. An important caveat is that they're still using the Play framework (Typesafe product), just now in Java instead of Scala.
It's unfortunate that Play serves two masters (i.e. Scala and Java), but industry demands it -- the argument that FP is the one true way goes out the window in face of current reality: enterprise by and large will go with mature tooling and cheap developers in a large-team-friendly language like Java over a paradigm shifting FP language like Scala, Clojure, or Haskell.
Looks like it is mostly used for compilers, cryptography, and risk assessment.
Whitepages is also Scala.
That's off the immediate top of my head.
Turing completeness ensures there's no "true way", but some languages offer better abstractions than others. In my experience, once you learn the abstractions, the functional paradigm has an edge about the ability to reason about the code.
Of course, the adoption of new ideas and technologies takes time, they need to be explored and fully developed. But even right now, you see many mainstream languages adopting functional flavors.
I believe that eventually, there will be enough successful large scale projects build with pure functional languages to convince skeptics, there's nothing wrong with "playing it safe" and wait.
If Scala is good enough as an example, I see an increasing adoption. As an anecdote, one of the biggest and Very Serious(tm) investment bank, is using Scala for most of their new initiatives, with a big team spread across the world. And the language itself was selected by a committee. You can't get more serious than that...
You mean .NET, PHP, and Java?[0]
[0] - http://trends.builtwith.com/framework
ps - For the record, I'm a rails/js guy
http://www.quora.com/Reviews-of-Functional-Programming-in-Sc...
> The reason, I'm hesitant to give it a fifth star is ultimately that I don't believe that Scala is a good language in which to actually do functional programming.
Literally the only other mainstream language that he would be able to say is capable of "fp" better than Scala would be Haskell.
You only need to have one look at it's module system/Cabal/Hackage to see that it was never intended for larger code bases than people's PhD thesis.
Yes, it can scale: In the same way PHP and JavaScript does.
Standard Chartered has a huge amount of infrastructure in Haskell. Clojure's too young to have the types of stories you're looking for, but it's had plenty of moderate-sized successes (as has Haskell).
The biggest FP project I was aware of was Twitter using Scala and they ended up completely backing away from it. Yikes.
Scala is different from Haskell. Scala has a lot of features that don't play well together, it has stability issues, and it has inherited some of the Java culture which means that there's a lot of terrible Scala code out there.
I've been working with Spark over the past month and I'm shocked by how bad the JVM/Hadoop legacy is. Spark itself is a neat idea. Getting it to work on an actual production cluster is a huge PITA. I'm tempted to just use Cloud Haskell.
I know people who've moved away from Scala (either to Java or Clojure or Haskell). No one who's moved to Haskell has ever regretted it. I know of about 15 companies that use it (not all on million-line projects) and they're all happy with it. I'm only aware of one case, in the past 7 years, where a company moved away from using Haskell: they moved to F# because they picked Microsoft up as a client and MSFT wanted to be able to say that $COMPANY_X was using their products.
The only other popular site that springs to mind is Hacker News, and frankly, it sucks. It's practically the Hello World of discussion forums.
It's written in Arc, which lost to Clojure. Also, HN is as good as it needs to be. It's successful on its own terms. It doesn't need to be a wonder of software engineering.
It will be once it gets a decent mobile view akin to viewing reddit on /.compact.
Anyway, good point--I've heard people complain that Haskell is hard to learn/understand, but I've never heard of anyone actually using it in production and regretting that decision.
* There's no widely used successful system written in Haskell. Yes, there's GHC, Agda, Idris and other research tools but they are marginal.
* It's untrue that mutable state is the main reason of problems with code. You can manage state in Java and C# in any other language.
* Haskell programmers are usually smarter than Java programmers, but they often don't want to work on tasks which they aren't very interested in, which are almost non existent, or have little business meaning.
* Haskell, actually has a lot of design flaws. The worst of them is the scope of record fields.
Google's Ganeti?
Microsoft's Bond?
> It's untrue that mutable state is the main reason of problems with code.
Its certainly one of the biggest, if not the single biggest (the only thing I can think of that gets cited nearly as much is multithreading/parallelism, and the main source of problems in that domain is also managing mutable state in that context.)
> You can manage state in Java and C# in any other language.
Sure, Turing equivalence means there is very little difference in what languages can do, just in how suitable the abstractions they present are to enabling humans to do it effectively.
> Haskell programmers are usually smarter than Java programmers, but they often don't want to work on tasks which they aren't very interested in, which are almost non existent, or have little business meaning.
So, take Java programmers (particularly smart ones) and teach them Haskell. Bang, you've got Haskell programmers without worrying about the interest distribution among pre-existing Haskell programmers. Learning PLs, for skilled programmers, isn't a huge deal -- the good Java programmers won't have much problem becoming good Haskell programmers.
Only 2 known products for 20+ years of being widely known and available is unimpressive.
More Haskell use in production: https://wiki.haskell.org/Haskell_in_industry
All writes to Facebook—on the order of billions per day—go through the Sigma site integrity service, whose rules are written in Haskell.
Yes but I think that the "value prop" with Haskell is that it forces everyone to abide to a certain discipline with respect to type safety and immutability.
> they are marginal.
Relative to what/whom? All the projects you have quoted are really successful and directly or indirectly pushed mainstream software engineering forward (i.e safer style).
Thanks, to a large number of extensions with questionable utility, it's very easy to write not only unmaintainable code, but just unreadable code.
>Relative to what/whom? All the projects you have quoted are really successful and directly or indirectly pushed mainstream software engineering forward (i.e safer style).
They aren't safer style. They are more related to math than to programming. I believe, they could have benefitted from being implemented in more mainstream language than Haskell.
I find evangelism gross, and in particular, developer technology evangelism especially distasteful.
That said, I take issue with the objectiveness of your points. For the first one, there are indeed quite a few successful systems written in Haskell (I suppose I might be quibbling with your definition of "successful"). Facebook is using Haskell for a few things internally (including their rule engine for fraud/spam processing), Standard Charter is using Haskell. In fact, here's a whole site of people using Haskell in industry (https://wiki.haskell.org/Haskell_in_industry)
I do think that it's only recently that you're starting to see projects/products built with Haskell that aren't libraries. Just this week there's been a bunch of web frameworks released (Airship and Spock, with Silk releasing a REST API framework a couple of months ago).
I'd like to see more projects that people can use that don't have to care about the fact that the software is written in Haskell (databases and data analytics systems are a particular area I'd like to see become less Java-focused).
Your second point on mutable state seems counter to a lot of the current conventional wisdom of the past five years, which is that immutability is vastly preferred to mutability. This is becoming true in Javascript (with React and Underscore), has always been true in Clojure, and is becoming more and more important in any system that deals with concurrency.
You can certainly disagree that mutable state is the root of all evil, or even the most important problem with modern development; but I don't think it's accurate to paint Haskell as being the weirdo fringe language that's advocating immutability is the way to go. They have a lot of company on that front, they've just been making the point for a lot longer than most.
Your third point seems like you just completely made it up. Do you have evidence that Haskell programmers are "usually smarter than Java programmers"?, or that they are somehow inordinately picky about what projects they work on? Do you know many professional developers who work in Haskell?
It's true that the population of Java programmers is probably an order of magnitude larger than Haskell programmers (the number of universities who still teach Java for their introductory CS classes would probably guarantee that's the case), but contrary to what message board lore would have you believe, Haskell isn't some magical "smart person" language.
I'm an idiot and I haven't had any trouble using it full-time. I don't use it for crazy math stuff, or advanced computer-science research. I use it to process events, interact with databases, and display CRUD operations (like probably 80% of most enterprise-y software development).
Haskell's design flaws, while certainly existent, don't seem appreciably above or below any other language (I'm trying not to be smug, I actually think Haskell is much better designed than most any other language). I can happily attest that the record field scoping has not actually been an issue (although maybe I've just been lucky, and there's actually a bunch of other idioms for dealing with the scoping issue like lenses).
[1] From slide 152:
- Old East Coast tech culture valued quality and
correctness, weak on practicality and communication.
- The new California-centric one emphasizes commercial practicality and communication
but doesn’t give a damn about software quality or excellence.You have to be somewhat of a game-player to pull off the Java-engineer-bidding-war game. You have to be the sort of person who will work on the most horrible projects just to move up the salary scale. You also have to live in the Bay Area or New York, and use competing offers to drive up your pay every 2 years or so.
At some point, though, these $300-500k Java engineers at tech giants (who, by the way, are mostly paid in stock with vesting, so if you're bearish on the markets, their comp is more modest than it appears) are going to dry out and have to go into big-company executive roles. Playing that game rots your brain, because you're spending more time looking like a great engineer than learning new things.
Some people who are just as smart as me have better boredom-proofing and can work on enterprise Java. Good for them. I can't do it. I'd leave the industry before I'd maintain someone else's Java mudball.
Its just made up isn't it? This is part of the problem. If you try to convince someone smart, experienced but skeptical by making things up, you hurt your own case.
(a) there are good business people out there,
(b) the fact that they trust idiots on tech is our fault as much as theirs
(we get too arrogant or too submissive and fail to convince them),
(c) we need to recognize that we and they have orthogonal skill sets
and aren't *prima facie* smarter,
(d) and this requires understanding certain cultural differences.
It's a long road, though. We're not a socially skilled tribe, for one. Secondly, there are a lot of terrible managers and business people in tech (more than in other industries) due to the Damaso Effect.IMO, good business people are people who are doing good for their business not using technology which their developers want them to use. They should consider things such as: ability to find developers, availability of training and books, availability well supported libraries, maturity of tools, code maintainability, etc.
>(b) the fact that they trust idiots on tech is our fault as much as theirs (we get too arrogant or too submissive and fail to convince them)
So, you are calling people who recommend to use technologies different from Haskell idiots, right? Or at least you pointing at them in your presentation. IMO, it's not the things which a professional should do. We have a lot of opinions, and it should be ok to have a different opinion. We shouldn't bash people who don't agree with us, otherwise, we will have (and I feel we already have) haskell cult.
Business people should not be making tech decisions. Most good business people don't know a damn thing about code maintainability etc and they shouldn't have to.
I agree. The ethical problem I have is with the short-termism. The next-quarter culture is absolutely horrible and that's what I hate. It's not directly related to choice of language, but often it gets tied up in that. The fact that Haskell requires some investment (and not a lot of it) is a deal-breaker, because so many business leaders are short-sighted.
They should consider things such as: ability to find developers
Java wins on quantity. It's probably easier to find good developers in Haskell. Even though there are probably more good Java engineers than good Haskell engineers, Java has a much lower percentage so your interviewing costs are a lot higher.
availability of training and books
Both Haskell and Java have enough.
availability well supported libraries, maturity of tools
Haskell is getting there, and Java has a lot of "enterprise standard" libraries (e.g. Spring and Hibernate) that will take you in the wrong direction.
code maintainability
Haskell wins.
So, you are calling people who recommend to use technologies different from Haskell idiots, right?
No. If, for example, you're doing low-latency trading, you're not going to use Haskell. Sometimes you want to use C or assembly. And while I prefer static typing, I think highly of Clojure and its community.
I think that there are a lot of idiotic reasons for using Java that get a lot of play. That doesn't mean that everyone who uses Java is an idiot.
When I point out that businesspeople trust idiots when it comes to technology, that's not to single them out. Realistically, I can't always tell a good car mechanic or lawyer from a bad one. You find that out over years, because there are plenty of people who can talk a good game but don't deliver the goods.
There's nothing (major) wrong with Python. It has some quirks, and I don't like the lack of tail recursion, but it also has a large community and mature frameworks. If you need to build something quick and will rely heavily on existing libraries, it's a great choice. If your project will have to scale and is guaranteed to go multi-developer, then you probably want Haskell's static typing.
Yeah.
"Wow, this file is really popular! Some tools might be unavailable until the crowd clears."
Even with the tools turned off there should be a way to simply view.