views:

5664

answers:

20

It is a wonderful, very fast, mature and complete language. It exists for a very long time and has a big set of libraries. Yet, it appears not to be widely used. Why ? I suspect it is because it is pretty rough and unforgiving for beginners, and maybe because its lazy execution makes it even harder

+9  A: 

Because it turns your brain inside out. Not that there's anything wrong with that.

Seriously, I understand that functional languages are more prevalent than you'd think in the financial industry. (Because of massive parallelization?) But when I asked a programmer I know at Goldman Sachs about it, he didn't know much about functional languages.

profjim
+1 unfortunately, there is a shortage of geniuses in the world
Gabe Moothart
I wonder if Oleg is ever on SO...
profjim
Kevin Won
Quantitative analysts at financial organizations may use functional programming, and maybe even some algorithmic traders, but for the core systems, C++ and Java are used for pushing data through trading systems and around the market.
Dr. Watson
You don't need to be a genius to use Haskell, just a competent programmer that isn't afraid of mathematical terminology. Oleg has also done work in other languages, and it's just as mind-bending as his Haskell stuff.
camccann
I think part of the problem is the vast majority has started programming on a procedural language (basic, java, python, ...). It's much easier to learn a new language that allows basic procedural coding, if you're already used to it.
wds
A very interesting case about OCaml in the financial industry: http://www.janestreetcapital.com/minsky_weeks-jfp_18.pdf It's worth reading.
Vitor Py
+8  A: 

Why aren't my favorite shows as popular as the reality show du jour? The lowest common denominator is accessible to everyone.

patros
Come on, man. We all know your favourite show is Teletubbies.
frou
The Teletubbies are so vulgar. A certain purple dinosaur will always have my heart.
patros
+8  A: 

"Big set of libraries" is subjective. Compared to Java, .Net, Python or PHP it's pretty small with few alternatives if a particular library doesn't quite do what you want. That said, the set of available libraries is increasing all the time and there's been a lot of progress in the last couple of years.

One reason why Haskell has not taken off so much in commercial development is that the focus of the Haskell community has tended to be more academic. They work on things that are important to them, not necessarily what is important to commercial software developers.

The community also have (had?) the unofficial motto of "avoid success at all costs". I take this to mean that if there were lots of people using Haskell and GHC this would likely result in a more conservative approach to progress, which is something they want to avoid.

Dan Dyer
My Linux distro has 1326 Haskell libraries, and that's not even all of Cabal. Now how much coverage they give, and how many useful alternatives, I can't say. But newcomers to the language (like me) quail at trying to keep track of what libraries do what.
profjim
agree on the comparitive lack of libraries. Also: it's weak specifically on the 'hottest' part of computing if by part we can include anything to do with the web. There just isn't much 1st class libraries for web dev. (I think that's sort of cool actually).
Kevin Won
The first question you have to ask about libraries isn't coverage, it's quality. How many of them are in alpha? How many are abandoned? How many are direct wrappers around C libraries (i.e. not very Haskelly in appearance, losing the benefits the language gives), and of those, how many are lagging significantly behind upstream?
Pavel Minaev
+6  A: 

Partly because it never gained mass in real projects, I guess, and that is intended to be circular reasoning. Popularity feeds on itself. There are network effects.

It's also different. Looking at the Next Big Things that I've seen for personal computers, there's BASIC, Pascal, C, C++, Java, and C#. These are all very similar in terms of how you'd write a function, although program organization varies wildly. Scripting languages also seem to follow this rule; Tcl isn't very popular any more.

David Thornley
+66  A: 

It has never gained mass in real projects.

Don't tell that to Credit Suisse or Standard Chartered, two banks which have made great use of Haskell. And don't tell Peerium or Galois or any of the other successful startups that use Haskell. Don't tell any Commercial Users of Functional Programming. And especially don't tell their customers!

What is true is that we don't see large masses of industry shifting to Haskell, for which I think there are good reasons:

  • The cost of entry is high.

    • It is very difficult to predict the time and space behavior of lazy functional programs.

    • You can't do anything serious without understanding monads and type classes.

    • Interfacing with the world beyond Haskell is hard enough that Simon PJ felt a need for the famous Awkward Squad paper.

  • Haskell is not taught much in US schools.

  • Related: people believe it's hard to hire Haskell programmers.

  • Industry rewards getting products out quickly, even if the products are barely adequate. Some ways to get things out quickly include

    • Stick with technology that the developers already know.

    • Throw lots of teams at the problem; first one with a successful approach wins.

Haskell is still at a stage where

  1. Each individual must invest substantial time and effort before he or she is productive.

  2. Once that time is invested, Haskell programmers can be extraordinarily productive relative to counterparts using, e.g, C#, Java, PHP, Python, Ruby.

Until there is a major shift in these factors, I think we will continue to see Haskell used in industry exactly as it is today: either by small programming teams inside big companies, or by small, elite teams in startups. These people will continue to use Haskell for competetive advantage in much the same way that Paul Graham advocates the use of Lisp.

Why is Haskell used so little in industry?

Because Haskell offers the highest payoff in situations where relatively fearless programmers can invest time up front developing new skills, then apply those skills in small teams. At present, finding this combination of programmers and context in a typical industry setting is still unusual.

Norman Ramsey
Kevin Won
@Norman Ramsey: your comparison is right on spot regarding "industry" acceptance... Paul Graham wrote Viaweb in Lisp and sold it for $50m or so, but what is less often emphasized is that latter on Lisp proved inadequate and it got all rewritten... In Java. That's the thing: it's great for startups, but good luck finding a team big enough that has the functional knowledge. It's a bit like the Twitter Scala/Java SNAFU. "We use Scala everywhere at Twitter... uh, oh, except for the part where performances are needed, that is 100% Java because Scala is less predictable".
Webinator
I sometimes think that if we can name most of the corporations using a language X in a single post, then language X is likely not used that much. I can certainly agree with your post, though.
I GIVE TERRIBLE ADVICE
Norman Ramsey
WizardOfOdds: From my memories of what Paul Graham has said about Viaweb being rewritten, it was more because a C/C++ solution was mandated from above than any performance issues with the Lisp solution.
Vatine
@Vatine: Yup sorry I wasn't clear... The perfs issue was related to Scala @ Twitter (where Java performed better), not to Viaweb. For Viaweb it got rewritten because basically they couldn't find enough Lisp wizards to maintain it IIRC. It's typical in this industry: see the interesting Norman Ramsey story. We *know* that for many tasks, for example, Erlang is just so much better, but we have to be pragmatic and think about maintainability. So you balloon to 5x or 10x the size, but weirdly it ends up being more maintainable, simply due to manpower availability.
Webinator
I find it a little ironic that the evidence you cite to prove Haskell has a substantive presence in industry is a committee geared toward finding if Haskell has a substantive presense in industry :)
San Jacinto
@San Jacinto: I think the case I'm trying to make is that Haskell has a *small* presence in industry, and to try to explain why the presence is (a) nonzero and (b) small. What you think is 'substantive' is up to you...
Norman Ramsey
@Norman Yes, I was just making a joke. Your point is well taken (at least by me).
San Jacinto
You know the quote "It has never gained mass in real projects." still stands if you read it as "not enough real-world projects have used it", which is how I read it. I think the person saying that (question asker?) meant to say "critical mass".
wds
"Haskell offers the highest payoff". What gave you that impression?
Jon Harrop
@Jon Harrop: laziness is the one extra powerful feature - of course, any such judgement can't be anything else than an opinion. To find out why laziness is important, this link is useful: http://lambda-the-ultimate.org/node/3131
Blaisorblade
Number of Haskell programmers at Credit Suisse falls to zero: http://haskell-news.blogspot.com/2010/04/number-of-haskell-programmers-at-credit.html
krawyoti
@krawyoti: that might be true (or not), but there is no further link from there to a reputable source, say from Credit Suisse. That blog is run by Jon Harrop, who is not surely a Haskell fan. This claim is also present in http://flyingfrogblog.blogspot.com/2010/05/why-is-haskell-used-so-little-in.html, and it seems to be acknowledged by Haskell users which worked in Credit Suisse (I'm not sure), but I can't find a link about that.
Blaisorblade
+12  A: 

Join the Industrial Haskell Group, or come to the Commercial Users of Functional Programming, and find out why groups do use Haskell for commercial projects.

Your question would be better phrased as: what holds functional languages back from widespread use, in general, as Haskell, if anything, is more widely used than most / all FP languages*.


Postscript: To justify the above claim, here's what informed it. Community data compared with similar functional languages: Scheme, Erlang, OCaml. I don't have data for F# as they don't seem to use traditional open source community tools.

Don Stewart
Are you sure ? That Haskell is more widely used than the other FP languages ? Any statistics?
bugspy.net
Lisp is probably the most widely used FP language for the same reason Cobol is the most widely used programming language. I do not think Haskell even comes second, but I do not have any argument for that.
Pascal Cuoq
I have a feeling that Scheme beats Haskell in terms of popularity
bugspy.net
@bugspy only based on attendance at the CUFP workshop, and on the size of the various communities. The fact is that we don't have good statistics.
Don Stewart
According to TIOBE, the top 5 most popular FP languages are Lisp, Scala, Erlang, Logo and Alice. The next in the list is "OCaml/F#," followed by Haskell, so I'm not sure if either of those Caml languages is actually more popular than Haskell or if they just win because it's two against one. At any rate, that's at least one measure that doesn't make Haskell look so popular.
Chuck
TIOBE's reasonable, but I'm not sure I quite believe that Logo and Alice are FP languages in wide use... :-)I can point out that 500 different developers have produced nearly 2000 libraries for Haskell in 2 years. I'd be surprised if any other FP language is close in the scope of the libraries or developer team.
Don Stewart
Come to think of it, TIOBE counts use in schools, which would explain the popularity of Logo and Alice.
Chuck
Why is Lisp/Scheme counted as a "functional language"? It's hospitable to functional programming, sure, but so can Python or Lua be. Most Scheme code I see is imperative.
profjim
@profjim: That would better be asked as a question rather than a comment IMO.
Chuck
OK, done: http://stackoverflow.com/questions/2291742
profjim
@Don: "Haskell, if anything, is more widely used than most / all FP languages". Mathematica has millions of users and dozens of commercial libraries. The F# Hub has over 20,000 registered members and F# has several commercial libraries. The Haskell-Cafe has 715 subscribers and Haskell has no commercial libraries.
Jon Harrop
@Chuck Be careful of TIOBE - it oscillates pretty crazily. May 30, 2010: the top 5 most popular FP languages are: 1. "Lisp/Scheme/Clojure" (one language!), 2. Haskell. 3. Alice 4. Caml/F# (1 language?) 5. Scala 6. Erlang. 7. ML.
Don Stewart
Javascript and Matlab allow FP and are both pretty popular...
Josh
Matlab? It allows for function handles, but as a functional language it is very primitive, and also unsuitable as a general purpose language because of its embarassing performance. And its official documentation does not lead you through the path of functional programming.Javascript is more interesting, but it's still more of an imperative language with functional features (actually, technically in this regard it seems similar as Lisp, it's just the usage pattern which differs).
Blaisorblade
+11  A: 

The advent of multicore is a serious problem for imperative languages and I believe bodes very well for Haskell in particular but also for all functional languages. I think that looking back in 10 years we will see Haskell a still uncommon but not fringe/academic language. Simon Peyton Jones shows graphs of Haskell adoption which have like a 45 degree angle to them--even taken with a grain of salt I think it is clear that Haskell is being looked at much more seriously than in the past. Erik Meijer did a 13 (!!) hour presentation on Haskell on channel 9 just recently which is like the biggest web presentation of the language I've come across. I believe this indicates the significant interest by industry regarding Haskell.

Oh... and Simon Peyton Jones is a researcher for Microsoft if you didn't know... and Microsoft (whatever else you might think of them) certainly tends to think in terms of industry... LINQ (part of .NET 3.5) is essentially chunks of Haskell grafted into C# by Meijer who has written/contributed much in the Haskell community, which, again, indicates to me the great respect and influence of Haskell at least in Redmond by folks involved with making .NET.

That said, I also believe that Haskell will need to add a lot of things that imperative lang folks (.NET, Java, Python, etc) take for granted: e.g. standard first class web libraries. There is a lot that is just plain expected as far as plumbing libraries are concerned that Haskell does not have, um, 100% Haskell-certified. The Haskell Platform is an effort to make that so, but there is a long way to go there compared to Java or .NET as far as tooling and standard libraries are concerned.

I think that .NET/Mono with LINQ and the new RX framework is an illustration of the general trend: to be relevant and vibrant, platforms will need to embrace and support functional as well as imperative styles. It's just unfortunate that with .NET it is imperative at core (i.e. the IL) instead of the functional at heart--it seems that it is becoming clear that in order to handle multicore that the platform is better off 'safe (pure) by default'-- and that's that is nearly the tagline for Haskell. To me, that indicates the most significant reason why I believe Haskell will grow--it's pure by default.

Kevin Won
It doesn't matter that it's imperative at heart because all modern computers are imperative at heart. Even Haskell compiles to imperative code. IL is an implementation detail and is not something you should have to care about as a developer.
Billy ONeal
just to clarify--I mean that the CLR is object oriented and impure. those were design decisions that are at odds with pure functional languages.
Kevin Won
+6  A: 

Because it was taught as part of first year uni programming and made everyone cry :(

The words Haskell and Recursion still make me cringe...

Edit:

I think I need to clarify this as people seem to be getting the wrong idea. I don't think Haskell is a BAD language. However, I had a bad experience when I was first introduced to it and I'm pretty sure that a lot of other programmers who did it as a core subject in first year university had a similar experience.

If you have a bad experience with a language, you're less likely to pursue it and to want to use it. Therefore as you progress through industry you'll probably not choose to implement such a language if there are alternatives available. This is the point I'm trying to make and I do think it's valid.

Perhaps you don't agree but that's the point of a subjective topic right? I'm more than happy to debate the point but blindly penalizing me for not sharing your opinion seems a bit harsh...

Ganesh Shankar
Seriously though, I understand WHY they thought us Haskell but it IS a difficult language for beginners. And programmers do tend to follow the languages which they enjoyed learning/coding in...(You can penalize me for this, but I believe it is a valid opinion)
Ganesh Shankar
I think this answer is more correct than people are giving it credit for.
Coxy
For a "subjective" topic, people don't seem to be very tolerant of opinions...
Ganesh Shankar
Recursion is a fundamental concept used in many areas of computer science. That an admittedly harder language was taught in a way that was hard for first year students is unfortunate, but probably doesn't shed light on why it isn't used in industry. C++ templates are not particularly easy, and probably aren't taught to first year students, and yet are extensively used in industry.
MtnViewMark
Thanks for the clarification. I removed my down-vote. Your clarification brings to mind two thoughts: 1) Indeed, the state of teaching or even talking about Haskell is too fraught with the abstract mathematics behind it. Fortunately, books like "Real World Haskell" are starting to provide more practical alternatives. 2) As our industry advances so rapidly, we have to view our university experiences as initial exposure, consciously seek out new understanding all the time. I hope over time, you'll learn new truths about recursion that won't make you cringe!
MtnViewMark
The same happened with (VisualAge for) SmallTalk at my uni, about 10 years ago. We all hated it, and it left such deep emotional scars that I haven't touched it since. Not sure whether the language or the interface was to blame.
kibibu
@MtnViewMark: I disagree. The fact that recursion is a universally-used principle in CS is true. The fact that Haskell is likely the worst language to consider in introducing programming to new programmers is also undoubtedly true. And if a concept is taught in a bad, unenjoyable, confusing way that concept **will not be used** later in life barring some really big changes. C++ introductory courses tend to avoid the hairier aspects of templates, so C++ isn't avoided by people who learned that way.
JUST MY correct OPINION
+18  A: 

I think that the problem is that haskell is not a closed box. You ever feel that you are learning it, no matter the number of years dealing with the language, despite the fact that you can do real programming after a few weeks. The code look clean and understandable. You don´t need to know how to define a new monad nor any else strange, but you feel uncomfortable at this level because there are lots of things to learn.

With Java and C, you can learn every trick conceivable in one year for example. Tou can look at other java code and you are sure you will understand it. You even feel yourself as an "Expert". you sell yourself as such and the confidence translates to your work, your self esteem and whatever.

A Haskell programmer never feel he knows enough. For this reason every newbie is treated so well by Haskell hackers, because they feel newbies in the deep. They know that a world of computational abstractions are there to discover. In a Java discussion group there are people that think that they know everything and has a sense of superiority.

Simply, The industry likes arrogant self confident people.

Alberto Gömez Corona
+1 For this interesting answer
bugspy.net
If the industry likes arrogant self confident people, the ability to spout unsubstantiated/subjective claims that your language "is more widely used than most / all FP languages", has "excellent support and performance [for multicore]", the most expressive type-system, and superior FFI, should definitely be an advantage, if anything.
Pascal Cuoq
If you think you can learn every trick conceivable in C in a year, I don't want you touching any of my C programs. Ditto for Java.
JUST MY correct OPINION
I liked almost everything of the answer except the "arrogance" part. Maybe you can't learn all of C in one year (I actually think you can), but I know most language corners, including preprocessor, enough to program the Linux kernel - same for the Java language (not platform of course).Whenever there's a language problem with those, I can solve it easily, while in day-to-day Haskell usage, I never know what's happening (yet), and even more so than C++. Many people reject C++ exactly because of this complexity - that's one reason why C is still widely used (by the Linux kernel people for one).
Blaisorblade
+4  A: 

It's just too different.

Valuable, experienced employees aren't going to be able to switch over from Java to Haskell overnight, so the switching cost is both high and a hard sell. We can argue that it's a more productive language, but it's not a 100% guaranteed home run. A company considering a switch is going to have a wizard C++ programmer who is possibly more productive than the person agitating for more Haskell usage, which makes the sales pitch less convincing.

If you are a small company, and your staff already knows Haskell (its popularity is increasing, after all), then you will still get pressure from large companies because it will be harder for them to integrate your components in the event of a buyout, merger, or working arrangement.

I have experience using FP languages in the research and prototyping phases of technology R&D, but I need to work in a way that will allow for a gradual rewrite to a more mainstream language. This is productive for me, but, admittedly, a burden for the production engineers. The rewrite is needed due to immature tool support on more exotic hardware platforms and the specific expertise of the folks who are taking ownership of the product. Once you have a working Haskell program that demonstrates a concept, risk management can dictate that you now eliminate the risk of working in an obscure language that has less collective wisdom about it and for which there are fewer available practitioners.

Anthony
What about the risk of rewriting a working program? I thought that this was usually considered a bad idea.
Noah Lavine
It is a risk, but the idea is to explore a really large design space (i.e. all possible programs) to find a solution to the problem, then do the rewrite in a much smaller design space (i.e. programs that are observationally equivalent to your exemplar).
Anthony
+3  A: 

Your question applies to a number of languages, not just Haskell.

PL/I is a great language. Many hated it because it came from IBM.

APL is a fantastic language ... it did not get very far because it used mathematical symbols and initially required a Selectric typewriter terminal with an APL type ball. Ken Iverson, ACM Turing award winner created APL and later J. J is free and ASCII based and very powerful. See http://jsoftware.com

Why are powerful languages not well accepted? Blame the educators. Many stick with what they know. Also, there is a lot of vendor influence. c got off to a good start because it came with UNIX and UNIX was more or less provided to universities for free.

Government is also to blame ... government sales are a huge part of the global IT budget. Many vendors often cater to governments rather than focusing on relatively unproven technologies.

So part of the answer to your question is there is that part of human nature that wants to play it safe. For many years with respect to hardware choices, there was a well known saying: "no one ever got fired for buying from IBM"; whether that saying is true or not, it shows that many decision makers are not willing to be part of the leading edge of technology.

BTW, Haskell is not necessarily the best language ... I doubt there's one best language.

If you look at FORTH, LISP, assembler, et cetera, there are many "best" languages. Some languages are terrible for some tasks and excel in others. That's why we have the saying that if your only tool is a hammer, then all of your problems will tend to look like nails.

The best that a programmer can do if her/his company does not use the language the she/he prefers is to attempt to influence her/his company and/or find another company that uses that language.

Regardless the language that one uses most frequently, it's a good idea to learn other languages, including ones that have significantly different paradigms.

Regards,
Gerry (Lowry)

gerryLowry
When did J go free? Last I looked at it (which is about fifteen seconds ago) the critical bits (VM and GUI code) were still proprietary binary blobs which can be opened as source only through extensive licensing fees and NDS signings.
JUST MY correct OPINION
Oh, +1, incidentally, for "I doubt there's one best language".
JUST MY correct OPINION
@ JUST MY correct OPINION -- J as a tool/language is free but is NOT open source. It's possible that some/ALL J source may be available for free for much earlier versions of J. Cheers
gerryLowry
+2  A: 

Broadly speaking, there are two kinds of software company.

Most software houses have a product or two that they sell. This product line is their chief asset; it embodies everything they know about their customers requirements and also represents several years of work for their programming staff. All development effort is spent maintaining and extending the existing products in a race to stay ahead of the competition. Rewriting any part of this is out of the question because that would mean their product would stand still in the market place for a year or two, at which point they would be out of business anyway.

Bespoke developers produce specialist software to order, in response to a specification produced by a customer. At the small end these are a mix of web development companies who build apps on top of an existing framework like Rails, and bands of code-monkeys-for-hire who use whatever technology their customer specifies. Neither can use Haskell. At the big end market forces cease to work because the apps they build are strategic investments for their customers, so when the software house tells the customer it will take twice as long and cost three times as much as the contract says, the customer can either agree or else abandon the project and return to square one. In practice the latter is usually not a viable option. Hence these companies bid whatever they think will win the business, even if it is substantially less than the likely cost. Then once the customer is locked in they can jack the price up at their leisure. Because there is no real connection between bid price and actual cost, there is no business case for investing in improved technology like Haskell.

This is an over-simplification of course. At the big end many companies have a hybrid model in which they sell a base product which is then customised. But the basic reasoning remains the same. It also applies to in-house software development; mostly this is aimed at maintaining whatever critical business apps already exist.

For an example of a big bespoke project where the client didn't just roll over when the contractor told them the price was going up, Google for "bskyb eds". This is an extremely unusual case because EDS were actually found to have been deceptive, but note just how far EDS had to go to lose even one count. If the divisional MD had a real degree, or had bothered to get an engineer to draw up a schedule (no matter how ridiculous) they would probably have won the case.

As people have pointed out, there are companies out there using Haskell to do real things. In time the competitive advantage provided by Haskell will mean that these companies will win out. See http://www.paulgraham.com/avg.html for a story along these lines. But this will take time. Haskell use seems to be doubling about every year, but since it also has less than 0.1% market share, at that rate its still going to take it several years to become a major language.

Paul Johnson
+2  A: 

Object oriented programming appeared as an attempt to adopt computers to the way people think.

Functional programming appeared as an attempt to make computers manipulate mathematical objects.

Not that many people are good at math. Hence object oriented programming is much easier for most people. Functional programming can be beautiful and intellectually satisfying, but it is hard and not too natural for humans.

Pure functional languages are not very good at handling state. It obviously can be done but in a rather convoluted way. Maintaining state is very simple in imperative languages.

shura
"Maintaining state is very simple in imperative languages." Which is why maintaining state is the cause of such a huge number of bugs.
Justin Smith
When I was first learning object oriented programming, it sure didn't feel like "the way people think". Then I learned to love it and was happy with Java for a while. However, after having programmed in Haskell for a couple of years, it again feels strange to me, having to shoehorn everything into objects. I think programming in a particular language shapes the way you think, more than the other way around.
Tom Lokhorst
The way people think naturally is disorganized and imprecise, because people are smart enough to "do what it means, not what it says". Computers are stupid, deterministic machines, so programming requires structured, abstract thinking, which is inherently *unnatural*. It's also what math is all about. Anyone who can't learn enough math to use Haskell (even if it takes a while) really isn't cut out for programming.
camccann
@camccann Exactly! In general; I'd say that someone who isn't capable of the correct level of abstract, structured thinking, isn't cut out for any kind of programming. That includes object oriented programming, they probably can't create the correct object abstractions and class hierarchies. The difference is that they can't get even the most basic programs to work in Haskell, but somehow seem to be able to muddle through in Java...
Tom Lokhorst
Computers are deterministic? I wish someone would tell my laptop that so it stops randomly freezing up. :D (Note: all digital components are made up of analogue components.)
JUST MY correct OPINION
@camccann, Tom Lokhorst: good programmers are able to abstract, but mathematics (and Haskell) very much requires you to abstract over abstractions (over abstractions). Most mathematicians I talked with about category theory were surprised that it could be used at all, exactly because it felt over-abstract to them (and they were students of abstract algebra!).One example are these valid comments about the potential problems of point-free style:http://www.haskell.org/haskellwiki/Pointfree#Problems_with_pointfree
Blaisorblade
@Blaisorblade: Yes, but it's not just Haskell. References and indirection in imperative languages with mutable state can be just as challenging. Where Haskell has pointless code, C has [three-star programmers](http://c2.com/cgi/wiki?ThreeStarProgrammer). Some of the more convoluted OOP design patterns start veering into the same territory as well.
camccann
The prototype of signal() is difficult to write, but you never do that. I don't claim being a Haskell expert, but I knew what to expect from the C compiler and could fix any error easily in 99% of cases, and anticipate most of them, while in Haskell that'd require manual type inference in many cases (especially in the few cases it doesn't work, including type families, for instance in the Vector package). Given how unhelpful are GHC's messages, I think I'll have to learn doing type inference as fast as counting before being a Haskell programmer :-(.
Blaisorblade
@Blaisorblade: Stuff using GHC extensions can get arcane, yeah. But if you want some quick general advice: 1) `undefined` has any type, use it as a placeholder to get things to type check so you can see what other stuff comes out as. 2) Add type annotations (including inline) for what you *expect* the type to be, this gives better errors than two inferred types conflicting. 3) Split large functions into smaller pieces bound at top level, then recombine them in GHCi and see what breaks when.
camccann
+4  A: 

The basic answer is that Haskell is very difficult to Get Things Done in.

Reasons include:

  • Lack of good libraries
  • Very stringent type system
  • Very few good tutorials that get you beyond mathematics
  • Inability to conform to standard paradigms
  • Lack of a very good IDE

Further, other languages provide exactly as much computational power with a far shallower learning curve.

While Haskell might be 'The Future', Lisp has been the future for 50 years, for exactly the same reasons as Haskell postulates now, and still isn't widely used.

Paul Nathan
+1: And interoperability. Popular new languages are either JVM- or CLR-based.
Jon Harrop
+3  A: 

Haskell is a very strictly single-paradigm language and an academic experiment in programming in a purely functional way. Occasionally (such as when dealing with massive concurrency) this restrictiveness does more good than harm, but the future of real-world programming is in multi-paradigm languages like Python, C#, Ruby and D that recognize that no one paradigm most clearly expresses every problem or even every small subproblem within a single module.

For real-world programming you need to be able to mix and match paradigms at a fine granularity and choose the right tool for the subproblem, not be forced into a strict one size fits all paradigm. I personally find all single-paradigm languages extremely restrictive, whether they are OO, procedural or functional. Using multiple languages is not the answer because it forces the blending of paradigms to be too coarse-grained.

dsimcha
+171  A: 
  1. Nobody's ever heard of it. No one's going to use something they don't know exists.

  2. It's unpopular. People assume that the most popular language is the best language, because if it wasn't good, it wouldn't be popular. This is actually untrue; as you can see, the most popular language is the most popular language. To put it another way, Haskell is unpopular because it's unpopular. This is what Haskell programmers refer to as "recursion", and despite what imperative programmers tell you, it's extremely common in The Real World.

  3. It's different. People are always afraid of what's different.

  4. It's difficult. People think that Haskell is difficult to understand or difficult to learn. This is almost certainly related to point #3. It's also related to the fact that the Haskell community is populated by people who casually remark "a monad is just a monoid in the category of endofunctors, what's the problem?" and expect normal human beings to comprehend this.

  5. It's risky. Most companies don't want to be the first to use something. Haskell isn't being used by many people, so not many people want to try it. (See this recursive unpopularity argument again?)

  6. Can't hire programmers. First, by #2, there aren't many programmers who already know Haskell. Second, most people believe #4, which means you can't train programmers to use Haskell. (At least, it would if it were actually true.) A language that you can't hire programmers for is a very, very risky proposition indeed. (Which leads us back to #5.)

  7. Libraries. This is probably the big one, so I'm going to spend some time on it.

    A. Quality. We have the quantity. We do not yet have the quality. Most of Hackage is one-man hobby projects with little to no documentation. Some of it is incomplete, some of it has long since bit-rotted, some of it malfunctions if used in certain ways.

    B. Multiple incompatible libraries. You can, in fact, connect to a database in Haskell. Trouble is, at the last count there's about a dozen libraries for doing this, and it's bewildering trying to figure out which ones are actively supported and which ones are zombie projects that stopped working years ago. It's also not as simple as hooking up an ODBC connection; there are different backends for each library and each DB target. Yay. :-/ That said, there is good breadth of databases, including new things like Mongo or Cassandra -- the open source aspect gives breadth if not depth.

    C. Windows. Almost all the important libraries (for cryptography, binary file formats, network protocols, data compression, talking to databases, etc.) are Haskell wrappers around C libraries. And these all fail to build on Windows. Given that Windows is the single biggest target platform on the market, this is a big deal.

  8. Unpredictable performance. This is way, way down at #8. Most people don't know enough about Haskell to even know this. Most people just assume that "Haskell is slow". This is demonstratably untrue. What is true is that it can be hard to predict the performance of a Haskell program. Subtle, apparently irrelevant changes can sometimes make big performance differences.

  9. Correctness. Most companies don't give a ** about correctness. They don't care about quality. They just want to shovel code out the door as fast as possible and earn wads of cash. If there are bugs, they'll charge the customer money to fix them. Getting code right is of no interest; getting code fast is what counts. Haskell is a language that rewards those who sit back and deeply analyse the problem, and them produce a beautiful solution. Most companies don't care for this approach; let's just hack something together as fast as possible, and worry about fixing it later (i.e., never).

There are a few places where correctness matters. These are either safety-critical systems, or financial systems, generally. I gather Haskell tends to be quite popular here.

One final pair of data points:

  • I can still remember not so long ago hearing people cry "C++ is a toy language for n00bs! You should use a proper programming language like C." Now take a look around you and see how many large-scale C++ programs there are.

  • People have been claiming that Lisp is "the next big thing" for, what, 40 years now? Lisp is older than almost every programming language in mainstream use. And how many large-scale Lisp programs are there?

Which fate awaits Haskell, I don't know. I rather suspect all the good ideas of Haskell will be stolen by the likes of C# and hybrids like F# or OCaml, and people still won't ever use Haskell itself. It's just too different.

But anyway, as to why industry doesn't use Haskell, see the points above. It's too rare, too unpopular, too weird, and has incomplete libraries. That's basically it, in a nutshell.

Orphi
That's a really complete answer! +1!
Paul Nathan
Yes. A really good and complete answer +1
bugspy.net
nitpick: "People have been claiming that Lisp..." Which people? Seriously, Lisp? I can't think of a single example but perhaps we're both suffering from selection bias.
wds
Although I voted up, I think #9 is not really fair about SW industry; there are companies out there that do strive to release good quality SW (I know some), and try to reduce the cost of maintenance (for customers and for themselves).
jfpoilpret
> I rather suspect all the good ideas of Haskell will be stolen by the likes of C# and hybrids like F# or OCaml,and people still won't ever use Haskell itself. It's just too different.This has sort of been the fate of Smalltalk - it's been strip mined for good ideas without ever being widely adopted. Which I guess is slightly better than being ignored :)
teapot7
I agree that Haskell will probably be mined for ideas rather than widely used, but this is actually sort of by design. According to http://www.computerworld.com.au/article/261007/a-z_programming_languages_haskell/, one of the informal slogans of Haskell is to "avoid success at all costs"--i.e., parts of the community prefer it to be not so widely used so it can be more flexible with experimental stuff (not necessarily a bad thing).
eman
one of the best answers I have seen here so far.
"Nobody's ever heard of it." So true! +1
fastcodejava
"RPC server and fire off a few procedure calls... good luck with that. Same deal for talking to databases, accessing OS resources, manipulating binary file formats." ----Please look more closely at http://hackage.haskell.org -- there are more than 2000 libraries, 50+ database bindings, 100s of System libraries , many for binary parsing, and by my count a dozen RPC libraries
Don Stewart
Don, you're going to have to take the rose glasses off and stop defending Haskell so vociferously. I like Haskell myself, but you have to admit that it lacks a lot in terms of coherence, consistency and support in its libraries -- and these days it's the *library* and not the *language* that makes or breaks a language. A perfect example is your "50+ database bindings". That was already referred to in the answer above: lots of bindings, very little cross-compatibility and many left in unusable states because they're **hobby hacker** projects, not professional grade.
JUST MY correct OPINION
Like CPAN, Haskell's library set is at the whim of open source developers. We have breadth of libraries, if not depth.
Don Stewart
I've written some more on the state of the Hackage libraries, and what we're doing about it. Better than complaining about too much Haskell code, IMO. http://donsbot.wordpress.com/2010/05/31/there-are-a-hell-of-a-lot-of-haskell-libraries-now-what-are-we-going-to-do-about-it/
Don Stewart
It's unfortunate that @Orphi didn't get any points for this excellent answer...
Judge Maygarden
A: 

It is just a catch-22, if something is unpopular, then it is very hard (can be rationally accepted as "impossible") to get popular.

Haskell requires so much learning curve and mathematics knowledge, plus, you must change the way you are thinking.

I am able to understand programming languages that I did not learn, except Haskell or Prolog, until I learned it later.

SHiNKiROU
+4  A: 

Who cares? Is it more important that a language is widely used or that the ideas that it is built upon spread far and wide?

(Obviously someone cares. But to me, it seems as though it's more important that the ideas behind Haskell get popular and not necessarily the language itself.)

MSN
This is a good point; and reading through the Haskell tutorial I'm pleasantly surprised at how much of it I understand thanks to bits of Haskell being scattered around inside Python.
kibibu
A: 

It is growing in popularity and almost getting popular in the investment banking industry but it is fair to say that problems recruiting suitable developers are holding back its adoption further.

So if you want a highly paid and challenging development job (albeit in London or NYC) then learn it.

If you are happy bashing out acres of boilerplate in programs that have a less than 50% chance of making it through the first cycle of testing then you'd best stick with Java or C#.

Libraries are getting richer, I abandoned Scheme (another functional language) in favour of Haskell for the sole reason that there are rich libraries to choose from. As with most other languages, you can always glue in C libraries if necessary so you shouldn't find yourself at a complete dead end.

Popularity is relative and changes over time. Java was niche and risky at one point, then it was the best thing since sliced bread and now is in decline.

Andrew
+10  A: 

Dear Jon,

Regarding what you said:

... I was horrified to discover that almost all of the "success stories" listed on the Haskell in Industry page ... were fakes: ... Bluespec were advertising their product but their customer testimonials were from "Elvis Lives", "Chicken Man", "Painful Eliminations", "Mr. Bigglesworth" ...

While it might make good theater to cite these names as customer testimonials for Bluespec, you might inform your readers that:

(a) These are not customer testimonials, but posts on John Coooley's EDA blog, Deep Chip (http://www.deepchip.com/items/0454-02.html)

(b) John Cooley promises anonymity to his correspondents, and John, as moderator, deliberately invents names like the ones you cite to deliver that anonymity.

Even though I work for Bluespec, I had no idea what you meant by "our customer testimonials" until I Googled the above. It's an unusual experience publicly to be called a fake, based on such thin evidence; I enjoy your sense of humor!

In case anyone is interested, Bluespec is actually doing quite well, and is being used productively by customers that make components that are, I'll wager, in the very computer on which you wrote your post. And, yes, Haskell is the main implementation vehicle for Bluespec's tools.

Cheers,

Rishiyur Nikhil (Bluespec, Inc.)

Rishiyur Nikhil