10 ms·
Why isn't Haskell popular in industry?
- theli0nheart 16y agoEvery language has a catalyst that pushes it from obscurity into mainstream use. Whether it be a project (Ruby on Rails), a programmer (Linus Torvalds -> C), a company (Google -> Python), or a library (Boost -> C++), there is always a force behind adoption. Most languages undergo a "fad period", where it's hip and cool to write in it and people just do it because other people do it. Clojure is going through this right now, as are Scala and (arguably) Haskell. We'll just have to see. I honestly hope Haskell becomes popular. Judging by http://shootout.alioth.debian.org/u32/haskell.php http://shootout.alioth.debian.org/u32/haskell.php, performance really isn't an issue. It's more of just an issue of programmer adoption and a willingness to throw yourself out there to spend some time to learn how to think outside of the imperative programming box.
- nvoorhies 16y agoI must be parsing this incorrectly because it looks like you're arguing that C was obscure before Linus used it.
- theli0nheart 16y agoYou're not. I want to add that he was just the first guy that popped into my head when I thought C. I questioned it at first too, but the more I thought about it, Linux itself could have just as well have been written in Pascal or Lisp. If it had been, perhaps a lot of the tools, drivers, etc that interact with Linux would've been written in that language as well? Perhaps a better example is needed.
- kmavm 16y agoC was never obscure in the way that Haskell is now and C++ once was. It was popularized by the project for which it was invented: UNIX, of which Linux is a two-decades-late clone. C's prevalence has always been closely tied to that of UNIX.
- arethuza 16y agoNot sure about that - I seem to remember reading some stuff from the mid/late seventies that was pretty skeptical about the whole idea of using a comparatively high level language for OS development. Similarly, I don't think C++ was ever obscure in that it was widely publicized as the "next" C and people were pretty keen to use it - it was more that the early tools for C++ failed to live up to the initial promise.
- dandrews 16y agoLet's not fixate on the examples, folks. Perhaps they're arguable, but the original point is still valid: languages gain traction through prominent projects.
- silentbicycle 16y agoRight, and C was an obscure reddit in-joke until Linux came along and gave it an air of legitimacy.
- roel_v 16y agoYeah, let's take a position in a discussion, defend it by examples (a questionable tactic, but let's roll with it for now), and then when someone picks apart the examples say 'let's not fixate on the examples, folks'? (not attacking the OP, I'm not convinced yet one way or the other on the topic, just saying that when someone is called on his arguments and methodology the refutation in an intellectually honest discussion shouldn't be vigorous hand waiving).
- tjr 16y agoI am similarly puzzled at the implication that C++ was obscure prior to Boost, given that C++ was pretty well entrenched in both industry and academia by the time work on Boost began in 1998.
- watmough 16y agoThis reddit post tells me why Haskell isn't that popular. http://www.reddit.com/r/haskell/comments/cs54i/how_would_you_write_du_in_haskell/ http://www.reddit.com/r/haskell/comments/cs54i/how_would_you... Writing a quick directory traversal function should be a no-brainer in any reasonably general-purpose language. The fact that the above reddit thread is jam-packed with the ins-and-outs of doing this simple task in Haskell tells me that Haskell may be great for some things, but it's probably not general-purpose, or a great fit for anything close to the heavy I/O, streaming, processing sorts of code I write. I actually own Real World Haskell, and have tried off and on to get into it, but I found that Clojure 'took' in my brain 1000x more easily than Haskell. It's a real bitch, because I'd love to be able to say I can write Haskell, but gosh-darn it, I just can't. Grrr. Sigh. quick edit: in answer to your point about a 'killer app' for Haskell, the parsec parser-combinator library looks bloody brilliant. Maybe if I run across a parsing need, maybe it'll help me get something useful out of Haskell, but I suspect my brain just doesn't get on with the Haskelly/MLy languages.
- derefr 16y agoWhat most other languages do, though, is exactly equivalent to Haskell's unsafePerformIO. If you want to interact with your environment in possibly-destructive ways (and sending a message out of the runtime, whether to the network or the OS, always has the possibility of being destructive, because you can never guarantee what a system not under your control will do in response to your message), just accept the reminder that it's not functional/idempotent/memoizable/whatever else, and do it. This is going to sound like an odd analogy, but saying "I won't use Haskell because I want to do IO, but don't want to unsafely do IO", makes you sound like a person playing a fighting game who blames their loss on the game not being "fair." If you're playing to win[1], and there's an "unfair" tactic, you use it yourself. If "cheating" at Haskell lets you do a higher-quality job, faster, than either using a different language or "playing Haskell as it was meant to be played" (i.e. being a scrub) then why not? [1] http://www.sirlin.net/ptw http://www.sirlin.net/ptw
- Confusion 16y agoExcept that it's not necessary, because at least 3 solutions that don't use unsafePerformIO were posted to that Reddit thread.
- Lewisham 16y agoTo expand on this, and on the OP, one thing that you need after the force is momentum. I strongly feel that if Ruby was just Rails, it would have petered out by now (maybe people might have even gone back to Perl and CPAN). I think that GitHub may well be the driving force behind Ruby at this point. GitHub gems are pretty decent, but like the OP points out, Haskell packages aren't.
- smcl 16y agoWas C really obscure before Linus Torvalds released\popularised linux? I'm fairly young so I have no knowledge of this, but it feels wrong. edit: just noticed a discussion about this exists already. That'll teach me to read all the comments in future :)
- jacquesm 16y agoI think giving Linus Torvalds the credit for pushing C into the mainstream is a bit much. Long before Linus came along C was the programming language of choice for anything from games to operating systems and so on.
- jberryman 16y agoActually a decent post and discussion.
- d0m 16y agoEven thought I don't agree on this argument, I would add: - Because it's not OO.
- cmars232 16y agoWhy doesn't Haskell support objects? Seems like that would be quite useful. They don't need to be mutable or anything. They could be like records, that scale.
- d0m 16y agoBecause there is already support for "records" as you say. Add the static type "interface" and you get a kind-of OO.
- silentbicycle 16y agoBecause it has typeclasses, which solve the same problems without creating the new problems that conventional objects do. Why doesn't Java support pattern matching?
- tkahn6 16y agoOr have closures yet.
- barrkel 16y agoTypeclasses don't solve the same problems as objects do. Typeclasses are a way of getting access to more operations in polymorphic code, which in functional languages is a compile time feature; they're also a way to implement overloading. Objects are a way of implementing protocols without needing to know the details of the object that implements the protocol, even at runtime. Polymorphic code in OO systems is a runtime feature, not a compile time one; objects may be loaded dynamically and almost always are at some level in any large OO system, for configurability and testing if nothing else.
- tkahn6 16y agoSince Haskell is statically typed, I think it's a feature, not a bug, that type parametricity is implemented at compile time. Also, I think what you're describing is the difference between parametric polymorphism and ad-hoc polymorphism.
- seldo 16y agoFailing to work on Windows is a much bigger problem than I think most people realize. You can write Java on Windows and (mostly) have it run on Linux or Solaris with no problem. And Windows has a 95%+ share in the corporate OS market. Ruby on Rails has a similar problem (though it's got better on Windows recently), and so does Django, which is a nightmare to get working in a Windows environment.
- Lewisham 16y agoI'm not sure that these are really the same market share segments. Django, Rails and all that server side stuff is best run on servers, which more often than not, are going to be running a *nix. Windows has C# and all that, and it works nicely for them. Perhaps this leads to a wider question of who the Haskell audience really is and what problems they think they solve. Lots of languages have pigeon-holes, Ruby has its super dynamism, Python is an excellent scripting environment, C is fast, etc etc. Haskell is... mathsy. Mathsy applications already have Matlab and such. I think at the end of the day, Haskell will probably remain a language from which other languages learn from, and that's OK, and that doesn't mean it's unimportant (I think even SPJ has said similar).
- bmj 16y agoI think the issue here is buy in from management. If I work at a Windows-centric shop, it's much easier to sell a different platform if it doesn't require building new servers for it. It's much harder to pitch a project when your requirements include new OSes and servers. For example, I work at a Windows-centric shop, but if I could make a compelling case to build a tool/product on a different platform, I could get my boss to approve it if it didn't require a new piece of hardware. We have written tools in other languages besides C#, but we stick to languages that are easy to deploy on our current servers.
- shadowfox 16y ago> Haskell is... mathsy. Mathsy applications already have Matlab and such I would think Haskell is "mathsy" in a much different sense than Matlab is "mathsy"
- 16y ago
- j_baker 16y agoHaskell's a statically compiled language. Wouldn't the "embeddable Haskell" the author proposes essentially be a library?
- andolanra 16y agoOnly to the extent that Firefox is a JavaScript library. I think the major idea is that there is some application whose operation is very broadly directed by the embedded language, in a sandbox-like environment designed for the embedded language. For instance, you could write a video game whose graphics and collision detection and whatnot are all C++, but have Haskell bindings so that all the high-level game code would be Haskell. This isn't all that different from the usage of the much more C-like UnrealScript, which is used for exactly this purpose and is both statically typed and compiled, if I recall correctly.
- stephenjudkins 16y agoI think there are a couple reason. Haskell is a significant departure from most other languages commonly used by industrial programmers. It's a relatively shallow learning curve from Java to Python to JavaScript, but making the leap to a pure functional language is very difficult. Path-dependence plays a huge part here. This isn't just a matter of "people being afraid of what's different" as the article suggests; there are very rational reasons for a profit-seeking firm to exploit the fact that their developers (and those available to hire) are already relatively proficient at writing procedural code. Another, more important reason, is that Haskell is too intellectually demanding for most industrial programmers. I consider myself an enthusiast of functional programming, but achieving anything practical using purely functional code remains extremely difficult for me, even though I regularly dabble in it during my free time. The Haskell IRC channel can be helpful, but it's very difficult to square "Haskell is easy enough for anyone to learn" with the inevitable "you are too stupid/impatient/incompetent to use Haskell effectively" taunts you're likely to hear, when you're asking for help to perform a simple task. Many Haskell evangelists don't understand that most developers aren't nearly as smart or dedicated as they are. I'd be curious to know where most Haskell users believe they lie on the distribution of programming ability. I'd estimate most of them lie at the 99% percentile, and that any of them arguing otherwise are doing so out of modesty. (Note that I'd include dedication and curiosity in with intelligence in this metric.) I believe the most likely explanation for this is that Haskell is a particularly difficult language to use effectively.
- gaius 16y agoAnother, more important reason, is that Haskell is too intellectually demanding for most industrial programmers. t While that's often stated as a reason, I don't believe it myself, simply on the grounds that anyone smart enough to use C++ "in anger" is smart enough to learn any language. The reason that Haskell isn't popular (IMHO) is that a lot of programming isn't clever algorithms, it's forms (interfaces for getting data into databases) and reports (interfaces for getting data out of databases). A lot more is glue (connecting the output of one program to another). Haskell just isn't a good fit here. I am very excited by F#; here we have an ML dialect that has minimal impedance mismatch with the OO/imperative world (and C# with LINQ has minimal impedance mismatch with the declarative world of relational databases). This is where Haskell types should look for work...
- codexon 16y agoI outlined some of the problems a while ago: http://www.codexon.com/posts/why-arent-functional-languages-like-haskell-and-ocaml-popular http://www.codexon.com/posts/why-arent-functional-languages-... Short version: Haskell is harder than C while being slower and uses more memory. The main implementation GHC, comes with GPL concerns.
- dons 16y agoGPL concerns? Its BSD licensed. Haskell's library system is perhaps uniquely BSD-friendly, with over 75% of libraries BSD licensed. And as pointed out at the time, commercial users already funded the -dynamic flag, along with the ability to swap out libgmp. So that's FUD. As was pointed out in this forum at the time: http://news.ycombinator.com/item?id=847120 http://news.ycombinator.com/item?id=847120
- codexon 16y agoThe default behavior was to statically link to libgmp. I don't know about you, but making people's programs GPL by default doesn't exactly inspire confidence in the industry.
- dons 16y agoWhether or not libgmp was ever statically linked by default depended on your distribution. Were you shipping apps on Windows prior to the -dynamic flag's introduction? If so, then you were watching what libraries you were using, and following these instructions: http://haskell.forkio.com/gmpwindows http://haskell.forkio.com/gmpwindows These days you can just run "cabal license-check" (IIRC) which will type check all the libraries you use for compliance. Have a nice day.
- codexon 16y agoDons, I know you are devoted to Haskell and will not take any criticism of it lightly. But I am not your enemy. I am willing to praise it myself when it is more suitable. Not when you try to spin it. You and your supporters succeeded in bombarding every article that even mentions Haskell the wrong way with snide comments, and probably won over a few hobbyists. At the end of the day though, the managers making the decisions will not think "Don Stewart said so, it must be true". They will find the same conclusions that Jon Harrop, myself, and other people you have ostracized have found. And this will continue until it even if you succeed in suppressing all negative feedback on Haskell. Have a nice day.
- nradov 16y agoBecause it doesn't run on the JVM. For a variety of reasons — including critical third-party libraries — anything that doesn't run on the JVM and interoperate with legacy Java code is just a non starter for my company. I suspect many other organizations are in a similar situation. It looks like someone is working on a JVM port now so hopefully we'll see something usable in a few years.
- loup-vaillant 16y agoJust to be sure: do (or would) your company use Clojure?
- nradov 16y agoIt's under consideration, among other options.
- dasil003 16y agoMost code just doesn't need to be guaranteed correct, plain and simple. If more code did, then Haskell would be more popular.
- Niten 16y agoI think the main issues are that lazy evaluation makes it more difficult to reason about the performance of your code, both in terms of what actually gets computed in which thread / on which core, and in terms of space requirements (lazy evaluation can force the runtime to keep things referenced longer than you might expect offhand). I'm not saying a good Haskell programmer can't overcome these obstacles, just that this is definitely a perceived barrier to commercial Haskell development. Check out this paper for a discussion of these issues in a real world Haskell application: http://www.starling-software.com/misc/icfp-2009-cjs.pdf http://www.starling-software.com/misc/icfp-2009-cjs.pdf
- rimantas 16y agoNot to answer the question, but I can provide some reasons why I am not going to learn Haskell. I must say up front that I know next to nothing about the language, and my reason my sound very irrational, superficial and plain silly, however: it just looks ugly. That's it. I cannot imagine myself sitting all day and staring (or writing) something that looks like explosion on a regexp factory with ruins of Perl fallen through. True, the beauty is in the eye of the beholder, however even if I believe there are beautiful thing which may need considerable effort and understanding to appreciate the true elegance of it I cannot imagine such thing being ugly at the first sight. For me it just looks like a lot of effort went just to make it look different. Maybe it makes perfect sense once you learn it, but it just does not look elegant and thus kills all the motivation to try. This all of course is IMVHO.
- loewenskind 16y agoReally? How beautiful it is is exactly what keeps drawing me to Haskell even though I have more invested in the dynamic language camp. >max = head . sort Due to the laziness, the above will find the max entry in O(n) time, just like your hand written loop would. How can you not find that beautiful? Now I do agree that they often seem to use too many symbols that look like other symbols but the few times I've investigated it actually ended up making sense (e.g. Arrows).
- Flow 16y agoYou mean max = last . sort ?
- loewenskind 16y agoNo, using head is what causes the result to be O(n) even though sorting should be more complex. By only using the first entry, only the first entry will actually be found by the sort. I assume you're pointing out that I have my sort backwards but I was being intentionally as ambiguous with this part because it's not relevant to the point I was making.
- lelele 16y agoHaskell is not popular because to be popular you must cater to the average Joe. And to cater to average Joe your foremost goal must be not making him uncomfortable about himself. Never forget this. And since most average Joes just work to pay their bills, they don't give a damn about technical superiority, you know.
- kunley 16y agoYeah but still being hacker is to make oneself uncomfortable when not being skilled enough, then to overcome this by practicing the skill. So maybe we should say that it depends if someone is a hacker or a coding monkey. I've seen rates of about 20%-80% in the industry.
- lelele 16y agoThat is implied in what I've said: hackers are a minority.
- zv 16y agoI'll have to correct you a bit. Judging by the article, Haskell currently isn't usable for work. So why should average Joe choose half-finished product? So why even the brightest hacker choose it when he already has all the tools he need?
- lelele 16y agoYou made a point. I've been rumbling on this lately, and I'm sharing my current conclusion here to hear HNers' opinions. Let's consider Common Lisp. Newcomers and outsiders complain that CL doesn't catch up because there aren't free CL environments around with a thoughtless setup (I've been in this camp too). However, if you read comp.lang.lisp, it jumps into your eyes that many lispers are accomplished and sharp programmers. Still, they haven't fixed such "issues" once and for all. So, what's the real deal? I think that here lies an explanation: such issues are not such an issue to experienced programmers. That is, if you can't setup a CL system, you simply are not skilled enough as a programmer. Get over it. I think the same applies to other systems like Haskell, GNU/Linux, Emacs and so on. What do you think? Thanks. EDIT: Of course, there are other causes to consider... for instance, since most CL developers work on *nix, there is less work done on Windows. I think that installing a CL environment kind of fires the Law of Leaky Abstractions: you'll have to deal with some nitty-gritty details...
- zv 16y agoWell I've read comments so far and I did not see anyone mentioning this. I program both on desktop and on web. On desktop I program C# which is mediocre and recently I have started using C++ with Qt. Qt has huge advantages over C# (QtCreator is IDE that is going to be better in time than Visual Studio, currently it lacks few features, but still I find it usable). On both languages I have my set of libraries which you can't find everywhere else and make my life easier. On web I use php and sometimes I use Rails. Each has advantages, I use php cause I've used it since php3 so a lot of historical baggage. On each I have my set of code and libraries I use the most. So lately there's a whole new languages and frameworks coming out. Why should I spend my time porting my libraries to Haskell? Do I get significant advantage coding in it? No, because I use mostly my own libraries.
- nephesh 16y agoAs someone who has been learning Haskell recently I think I can bring up a point that no one else has. Record syntax in Haskell sucks. Most business programming revolves around a form of DDD, where each of your business entities are fairly well defined. Creating records that match these business entities is fairly simple, working with them is not. None of the web frameworks I've seen follow a model based approach where you bind directly to your form representation of a model. I've been trying to figure out a way to do this in Haskell, but it looks like I have to learn Template Haskell and Generics on top of the already steep learning curve of Haskell, for something that would be simple in almost any other language. So far I haven't given up, but I don't see mainstream programmers getting into Haskell until they can describe their processes in a model focused fashion (and no, I don't mean with OOP).
- MissT 16y agoHaskell's motto is "Avoid success at all costs!" It succeeded. I appreciate the fact that Haskell's designers don't look down on "average" programmers like the Java designers did but I think it's sad that they don't look at all.