News for hackers. Stuff that matters.
Re:The Evolution of a Haskell Programmer (2001) by tdeck on Monday February 08, 2016 @04:11PM (#11060915)
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.
Re:The Evolution of a Haskell Programmer (2001) by jfoutz on Monday February 08, 2016 @04:22PM (#11060988)
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.

Re:The Evolution of a Haskell Programmer (2001) by tdeck on Monday February 08, 2016 @10:33PM (#11062873)
Only on Hacker News is Rust considered a mainstream language, but I see your point :).
Re:The Evolution of a Haskell Programmer (2001) by jfoutz on Tuesday February 09, 2016 @12:45AM (#11063375)
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.
Re:The Evolution of a Haskell Programmer (2001) by tormeh on Monday February 08, 2016 @04:20PM (#11060976)
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.

Re:The Evolution of a Haskell Programmer (2001) by cageface on Monday February 08, 2016 @06:21PM (#11061735)
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.
Re:The Evolution of a Haskell Programmer (2001) by DonaldFisk on Monday February 08, 2016 @07:54PM (#11062221)
... which Lisp had in 1960.
Re:The Evolution of a Haskell Programmer (2001) by such_a_casual on Monday February 08, 2016 @09:04PM (#11062545)
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?
Re:The Evolution of a Haskell Programmer (2001) by omaranto on Monday February 08, 2016 @11:34PM (#11063085)
Ruby counts as mainstream, right? It is expression based.
Re:The Evolution of a Haskell Programmer (2001) by dllthomas on Tuesday February 09, 2016 @12:24AM (#11063298)
> explicit scoping like let and flet?

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

Re:The Evolution of a Haskell Programmer (2001) by such_a_casual on Wednesday February 10, 2016 @04:28PM (#11076164)
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?
Re:The Evolution of a Haskell Programmer (2001) by dllthomas on Wednesday February 10, 2016 @08:18PM (#11077603)
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.
Re:The Evolution of a Haskell Programmer (2001) by such_a_casual on Wednesday February 10, 2016 @10:09PM (#11077990)
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.
Re:The Evolution of a Haskell Programmer (2001) by dllthomas on Thursday February 11, 2016 @01:01AM (#11078483)
"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).

Re:The Evolution of a Haskell Programmer (2001) by such_a_casual on Friday February 12, 2016 @02:15AM (#11085754)
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.
Re:The Evolution of a Haskell Programmer (2001) by DonaldFisk on Monday February 08, 2016 @04:55PM (#11061162)
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.
Re:The Evolution of a Haskell Programmer (2001) by tdeck on Monday February 08, 2016 @06:00PM (#11061597)
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".
Re:The Evolution of a Haskell Programmer (2001) by mbrock on Monday February 08, 2016 @06:23PM (#11061755)
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.
Re:The Evolution of a Haskell Programmer (2001) by DonaldFisk on Monday February 08, 2016 @07:40PM (#11062148)
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.
Re:The Evolution of a Haskell Programmer (2001) by tdeck on Monday February 08, 2016 @07:49PM (#11062197)
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.

Re:The Evolution of a Haskell Programmer (2001) by DonaldFisk on Monday February 08, 2016 @08:25PM (#11062378)
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.
Re:The Evolution of a Haskell Programmer (2001) by pekk on Monday February 08, 2016 @05:21PM (#11061294)
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.

Re:The Evolution of a Haskell Programmer (2001) by the_af on Monday February 08, 2016 @05:37PM (#11061412)
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.
Re:The Evolution of a Haskell Programmer (2001) by gertef on Monday February 08, 2016 @06:37PM (#11061844)
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
Re:The Evolution of a Haskell Programmer (2001) by elihu on Monday February 08, 2016 @07:44PM (#11062170)
...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?
Re:The Evolution of a Haskell Programmer (2001) by DonaldFisk on Monday February 08, 2016 @05:38PM (#11061415)
> 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.

Re:The Evolution of a Haskell Programmer (2001) by dragonwriter on Monday February 08, 2016 @05:41PM (#11061446)
> 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?

Re:The Evolution of a Haskell Programmer (2001) by GFK_of_xmaspast on Monday February 08, 2016 @04:45PM (#11061103)
The more functional/immutability/strong typing/etc that gets into mainstream languages, the less compelling haskell becomes.
Re:The Evolution of a Haskell Programmer (2001) by Peaker on Monday February 08, 2016 @05:23PM (#11061304)
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.

Re:The Evolution of a Haskell Programmer (2001) by eru on Monday February 08, 2016 @06:14PM (#11061691)
> 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.

Re:The Evolution of a Haskell Programmer (2001) by wereHamster on Monday February 08, 2016 @11:58PM (#11063195)
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.
Re:The Evolution of a Haskell Programmer (2001) by eru on Tuesday February 09, 2016 @12:26AM (#11063304)
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.))

Re:The Evolution of a Haskell Programmer (2001) by GFK_of_xmaspast on Tuesday February 09, 2016 @09:48AM (#11065583)
> 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)

Re:The Evolution of a Haskell Programmer (2001) by eru on Tuesday February 09, 2016 @06:41PM (#11069738)
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