Live data from Hacker News

Why isn't Haskell popular in industry?

palgorithm.co.uk

61–70 of 145 posts

Re: Why isn't Haskell popular in industry?

#61
post #29
post #27

Earlier quoted context omitted.

The 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.

Whether 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 These days you can just run "cabal license-check" (IIRC) which will type check all the libraries you use for compliance.…

Dons, 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.

Re: Why isn't Haskell popular in industry?

#62
post #39

Earlier quoted context omitted.

Because it has typeclasses, which solve the same problems without creating the new problems that conventional objects do. Why doesn't Java support pattern matching?

Typeclasses 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 runt…

Because two features are different doesn't mean they don't solve the same problem. Here, most of the time, class polymorphism is used to solve problem best solved with parametric polymorphism (sometimes called genericness).

    class Base
      Base(int i_init)         -- constructor
      virtual int f(int param) --  a method
    
    class Inherit1 (extends Base)
      int f(int param) -- reimplementation 1
    
    class Inherit2 (extends Base)
      int f(int param)  -- reimplementation 2
    
    class Inherit3 … (ad nauseam)
We don't need class polymorphism with inheritance, here. We can do simpler:

    class Base
       Base(int i_init, int f_init(int)) { f =: f_init; … }
       int f(int)
Or even simpler:

    int f(int i_init, int f_init(int)) // C-like syntax
    f: int -> (int -> int) -> int      -- Haskell syntax
(And don't tell me that passing function as parameters is weird, or complicated. Functions are typically way simpler than "Objects".)

Re: Why isn't Haskell popular in industry?

#63
post #31

I 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; the…

Another, 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 getti…

Why is Haskell not a good fit for glue? That's what I use it for, and it works great -- my programs are short, efficient, and easy to write and test.

My first Haskell project for work was initially a C++ project, but it was too hard to use C++ as a glue language, so I switched to Haskell. I would have used Perl, but Haskell works better on Windows and has an easier-to-use FFI.

I actually ended up spending more time trying to get some old version of Visual Studio to link against my super-old-proprietary-C-library that was the core of my project than I did writing the whole Haskell FFI binding to that library and writing the first version of the Haskell-based program.

This turned out to be the most trouble-free program I ever wrote. It had to operate on large datasets, and never died in the middle (like I'm used to with Perl). The only bug that the program ever had was where one of my data validation rules was too strict, and rejected some valid date. (The validation rule said that the dates in the time series had to be increasing. But one series only had one point, and hence wasn't strictly increasing. The bug resulted in "Warning: bad data", though, not "Prelude.(!!): index too large", as the implementation was with fold.)

Incidentally, as a result of this project, c2hs supports Windows DLL calling conventions :)

Re: Why isn't Haskell popular in industry?

#64
post #53

Earlier quoted context omitted.

Really? 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 investig…

You mean max = last . sort ?

No, 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.

Re: Why isn't Haskell popular in industry?

#65
post #31

Earlier quoted context omitted.

Another, 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 getti…

Why is Haskell not a good fit for glue? That's what I use it for, and it works great -- my programs are short, efficient, and easy to write and test. My first Haskell project for work was initially a C++ project, but it was too hard to use C++ as a glue language, so I switched to Haskell. I would have used Perl, but Haskell works better on Windows and has an easier-to-use FFI. I actually ended up spending more time t…

After having written that, I realized it was more nuanced than that. Haskell's good for parsers, for example. I am actually working on one for a proprietary logfile format right now (it will "convert" said logfiles into SQLite .dbs). But if you have preexisting libraries for system A in Java and system B is CORBA then you would be mad to put Haskell in the middle, the impedance mismatch is too great.

Re: Why isn't Haskell popular in industry?

#66
post #47

Haskell 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.

Yeah 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.

Re: Why isn't Haskell popular in industry?

#67
post #61
post #29

Earlier quoted context omitted.

Whether 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 These days you can just run "cabal license-check" (IIRC) which will type check all the libraries you use for compliance.…

Dons, 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 dec…

The only thing I ever saw Don Stewart "bombing" were factual evidence. And what he destroys by truth should be annihilated anyway (P. C. Hodgell).

"Don Stewart said so, it must be true" actually isn't such a bad heuristic (as far as Haskell is concerned). From what I've seen, Don is quite cautious.

Re: Why isn't Haskell popular in industry?

#68
post #9

Failing 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.

Haskell is fiddly to use on OSX too. All the devs seem to have moved to OSX 10.6 and it isn't being fully tested on 10.5.8. Now you might say "just upgrade" but that's not the point.

I am running a Debian VM in VirtualBox for my Haskell work now... That's great when it's just me playing, but not so much for production code.

Re: Why isn't Haskell popular in industry?

#69
post #57

Earlier quoted context omitted.

Perhaps the reason that Haskellers don't describe monads as "just sections of the program that are imperative" is because that statement is _not_ true. A monad is a very nice container abstraction - period. The IO part of Haskell just happens to leverage monads. One of the benefits of which is an explicit marking of impure methods in the type signature, but there are others. Monads are used in plenty of purely functi…

Can you give an example of where monads are not used to interact with stateful things? That would be helpful to me.

I don't know how familiar you are with Haskell... but anyway:

Say you're working with the Maybe type, which is often used to represent operations that might fail, such as a map lookup, for example.

  data Maybe a = Just a | Nothing
We're using two functions defined like so (feeling unimaginative at the moment, forgive me):

  x :: String -> Maybe String
  y :: String -> Maybe String
We want to use them together. Someone who's not familiar with monads might write something like this:

  myFunction text = case x text of
                      (Just newText) -> y n
                      Nothing        -> Nothing
(If x works and returns a value, put that value into the y function. If x didn't work, just return Nothing)

It works fine, but imagine you had 3 functions that returned Maybes, it would get tiresome and messy nesting all those case statements endlessly.

  [...]
  case x text of
    Just newText -> case y newText of [...]
Not being satisfied with boilerplate, lets make an operation that will simplify this a bit:

  bind :: Maybe a -> (a -> Maybe b) -> Maybe b
  bind (Just x) f = f x
  bind Nothing  _ = Nothing
now we can define myFunction like so:

  myFunction text = (x text) `bind` y
if we want to add another operation:

  myFunction text = (x text) `bind` y `bind` z
Congratulations you've mostly made a monad. Bind is one of the monad operators (>>=), the other operators are extremely trivial to implement for the Maybe type.

This is why we say a monad is just a container with some handy operators. Maybe is the container, and bind is a way to chain together operations (without explicitly taking the value out of the container) so the operators themselves don't have to know anything about the nature of what they're dealing with.

I won't bang on anymore, this is a longer, better written tutorial[1] in the same vein as this short summary.

[1]: http://blog.sigfpe.com/2006/08/you-could-have-invented-monad...

Re: Why isn't Haskell popular in industry?

#70
post #57

Earlier quoted context omitted.

Can you give an example of where monads are not used to interact with stateful things? That would be helpful to me.

I don't know how familiar you are with Haskell... but anyway: Say you're working with the Maybe type, which is often used to represent operations that might fail, such as a map lookup, for example. data Maybe a = Just a | Nothing We're using two functions defined like so (feeling unimaginative at the moment, forgive me): x :: String -> Maybe String y :: String -> Maybe String We want to use them together. Someone who…

I appreciate that. I am actually familiar with Haskell and the Maybe monad.

Are there use cases for Maybe where you're not interacting with some sort of IO?

Post reply on HN