Hacker News new | past | comments | ask | show | jobs | submit login

Every year since I've started to read about programming (maybe 10 years), Haskell (and pure functional programming in general) has been the Next Big Thing. I don't have anything in particular against Haskell, but its failure to "arrive" makes me think the answer to your question is no.



Evolution is slow. Java imho brought garbage collection to the mainstream. lisp had been doing that for 20 years or so.

I don't think Haskell itself will ever be the language of choice, it'll probably fall into (remain in?) a smalltalk like life.

That said, functional idioms seem to be creeping into lots of mainstream languages, so it's not like never. Rust seems pretty heavily influenced by ml, and somewhat by haskell.


Only on Hacker News is Rust considered a mainstream language, but I see your point :).


Ha! Totally agree. I do think rust has a lot of potential to take a big bite out of c/c++'s current share. But that's 10 years away, because evolution is slow.


Well, functional programming has a lot of good ideas in it, it's just that people generally want the functional stuff in addition to, or at least only partially replacing, the imperative stuff. Laziness has gone out of style. Object orientation is going nowhere.

Functional programming is arriving right now, but not as Haskell.

As an aside, I think of Haskell as a sensei/guru saying, "Young grasshopper, if you want access to the glory that is my wisdom you will have to wash my dishes and scrape off my calluses for the next three years" to which my personal reply is "Hell no". It¨s unfriendly and it doesn't respect my time. Is there wisdom in Haskell? Probably, but I don't have the patience to deal with the bullshit.


I don't think Haskell will ever become mainstream but concepts that originated in research languages like Haskell are increasingly common in more pragmatic mainstream languages. Swift owes a lot to the ML & Haskell family of languages, for example, and even C++ and Java have lambdas now.


... which Lisp had in 1960.


When I look at some of the fundamental differences between lisp and the mainstream languages (like everything-as-expressions and explicit scoping of variables and functions), I realize that Lisp is centuries ahead of its time. How long is it going to take mainstream languages to implement explicit scoping like let and flet? 75 years after lisp was born? How long for everything-as-expressions (which gives code a logical structure and eliminates the need for throwaway variables)? 100 years? 200 years? Will we even have programming languages by then?


Ruby counts as mainstream, right? It is expression based.


> explicit scoping like let and flet?

I'm not sure how this is different than introducing a block in C.


I haven't programmed in C, but my view comes from this video: https://www.youtube.com/watch?v=QM1iUe6IofM&feature=youtu.be...

What would be the C equivalent of:

    (let ((last-response))
      (defun get-response ()
        (print last-response)
        (setf last-response (read)))) 
    
    (print (get-response))
    (print (get-response))
Notice that no other function can use last-response. It only exists for get-response, but it exists outside the scope of get-response. Does C have this?


As used here, there's two ways you can do this in C.

Since the variable in question is only used in one function, you could declare the variable static to that function. It takes some care to make this reentrant, but that's possibly the case in lisp as well.

To share between multiple top-level functions, you can only limit scope to the individual file.

The bigger thing C can't do that lisp can here is defining new functions in arbitrary places. In C variants where you can define local functions, you can indeed capture variables in local scope. And within a function, you can limit scope by creating a new block:

    int test() {
        int foo = 7;

        {
            int foo = 9;
        }

        return foo; // returns 7
    }

Even in those C variants, you can't place a new function in global scope from within a function.


I did not know C had static variables at the function level (thank you for pointing this out), but static variables are not the same thing as what I'm thinking of when I say "explicit scoping". It would basically be like writing curly braces for variable declarations the same way one does with function definitions. Because lisp has this it's trivial to extend the scope of the variable to cover multiple functions:

    (let ((x))
      (defun func1 ())
      (defun func2 ()))

This is what I mean when I say explicit scoping. And it means that the reader/debugger/maintainer knows that this variable only exists for these functions. A static variable's scope is implied by the scope of whatever it's defined in (not sure if that's limited to functions in C), in this case X exists outside of C and has it's own scope, not just it's own extent.


"Because lisp has this it's trivial to extend the scope of the variable to cover multiple functions:"

Yes, I mentioned that static variables in a function would not extend to multiple functions.

You can share a variable between a restricted set of top level functions by grouping those functions in a single object file that does not expose the variable in question.

I think my only objection is that your phrasing implied what's different is the explicitness of the scoping, when it's actually the flexibility of how functions can be defined (unsurprising, from a lisp).


I used the word explicit because I was thinking something along the lines of: the scope in lisp is explicitly defined with parentheses (). Where as something like a static variable (or pretty much any variable that's defined in Algol like languages) has implicit scoping, it's implied that it shares the same scope as the scope it's defined in (or some other implication like C#'s public). I'll have to find a better way to word it because you're right. Thank you for the discussion.


Many, perhaps most, programmers from mainstream languages (i.e. Algol derivatives) find it difficult to get their heads around Haskell in particular and functional programming in general (including Lisp). This is not a problem with Haskell.


This is the excuse we've been hearing for the past 20 years. "It's not a problem with the language/paradigm, it's a problem with you/humanity".


I learned Haskell in school. Then I worked with it in a web startup. I've done fun hobby projects with it. I really enjoy it a lot. I'm not super smart and I don't know any advanced math. I'm not sure what the problem is at all. The language works fine, has a vibrant community, it's growing, and it's inspiring lots of programmers and language designers too.


I don't think I'll ever be a great concert pianist, but I just accept this as one of my limitations. I have never put in the necessary effort, and even if I did, I doubt I would have the required amount of talent. It would never have occurred to me to blame it on pianos.


And if the piano were an instrument almost nobody used and on which almost no popular or well-regarded music were played or composed, I'd agree with this snarky reply. This isn't a particularly apt analogy because concert pianists are judged by their output (i.e. piano music). The argument from the Haskell community seems to be that almost nobody is interested in using the tool (Haskell) for its intended purpose (writing software) because the people themselves are deficient. Haskell is a character-building exercise to write blog posts about, even after all these years, rather than something to be adopted in production.

And before you think I'm just hating on Haskell, the same is essentially true of Lisp as well.


My position is that learning functional programming lies within the grasp of many if not most programmers if they put in the necessary effort, and well worthwhile as it will make them better programmers as they will then see ways of solving problems that hitherto wouldn't have occurred to them, or are painful to implement in other languages. I wouldn't be put off a language (whether Haskell or Lisp) simply because some of its programmers come across as a bit condescending.


Usually, in any other area, an interface made intentionally to be unintelligible to the general public as well as a professional target audience would be derided as bad design.

In the case of Haskell, it is taken as a badge of virtue, and it is a matter of faith that the problem is just that all other programming languages have mis-educated everyone who doesn't "get religion" about Haskell.

If Haskell's interface is hard to understand, that is a problem with Haskell.


Haskell's interface isn't intentionally unintelligible. In fact, it's not unintelligible at all (don't confuse playful exploratory code with standard code, just like you wouldn't think obfuscated C is standard). It's just that you're unfamiliar with it. Most ideas behind Haskell are quite logical and systematic.


Haskell's "badge of virtue" is that it's unpopularity has freed the language creators to improve the language, to get closer to solving the extremely sophisticated problem it is trying to solve (completely safe, efficient, correct programs), without breaking anyone; not that others are miseducated


...and yet, some people really like programming in Haskell, and use it for all sorts of problems. Do you think they're all just pretending to have fun, or that they're obliviously unaware of the merits of mainstream languages like Java, Python, or Javascript?


> Usually, in any other area, an interface made intentionally to be unintelligible to the general public as well as a professional target audience would be derided as bad design.

Evidence that Haskell was deliberately made difficult to understand? And supposing this were true, why hasn't anyone made the interface more intelligible?

> If Haskell's interface is hard to understand, that is a problem with Haskell.

That's a bit like saying that if the mathematics used in the General Theory of Relativity is hard to understand, it is a problem with the General Theory of Relativity.


> That's a bit like saying that if the mathematics used in the General Theory of Relativity is hard to understand, it is a problem with the General Theory of Relativity.

Well, but that's true; if there were easier-to-understand mathematics that had equal utility, it would be superior. The math being hard to understand is a problem, but (as far as anyone can tell), its a necessary cost with General Relativity.

So, for Haskell -- granting, for the sake of argument, that it is particularly hard to understand (which I'm not sure is really the case) -- the question is the complexity a necessary price for some benefit that is worth the cost?


The more functional/immutability/strong typing/etc that gets into mainstream languages, the less compelling haskell becomes.


Do note that Haskell is moving forward all the time, and at a rate faster than mainstream is adopting these ideas.

Mainstream languages have lambdas, more immutability and stronger types? That's great (non-sarcastically!). Haskell now has GADTs, rank-n types, polymorphic kinds, type families (poor name for type-level functions), and more.

These things make Haskell still quite compelling over other more mainstream languages, if you're willing to learn.


> Do note that Haskell is moving forward all the time, and at a rate faster than mainstream is adopting these ideas.

In some sense, yes. On the other hand, there are diminishing returns. As an example, the increase in software quality from a Java-like language adopting any of algebraic data types, parametric polymorphism or first class higher order functions is probably much bigger than Haskell moving to full on dependent types.


I have yet to find a mainstream language which implements any of those features well. Show me one which didn't have and now has proper ADTs.


Depends on how high you set your standards. Ie Python mostly has higher order functions that work, even though for mostly syntax reasons they interact badly with mutating variables---a bit of sugar would help a lot.

In any case, your point stands and complements mine.

(Apropos ADTs, did Scala always have them? From what I can tell their syntax is pretty awkward, though.

Google's Protobuf, which in some sense denotes a type system, even if not a programming language, did get something like ADTs: https://developers.google.com/protocol-buffers/docs/proto3#o...

I am pretty lenient, and would go for anything that resembles a compiler-enforced tagged union. (Think C-style union.))


> I am pretty lenient, and would go for anything that resembles a compiler-enforced tagged union

http://www.boost.org/doc/libs/1_60_0/doc/html/variant.html ??? (and I think it's supposed to be coming in c++17)


That's interesting, thanks! It seems this one discriminates the different possibilities by type, and not by some extra tag (like the constructor in Haskell's ADTs). I wonder how that works, if you want to write something like the `either' function (or even just write down its type in C++):

    either :: (a -> c) -> (b -> c) -> Either a b -> c




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: