Live data from Hacker News

Teenage Haskell

twdkz.wordpress.com

41–50 of 93 posts

Re: Teenage Haskell

#41
post #40

Earlier quoted context omitted.

At the TU-Berlin, our intro courses were held in FP languages, and we were indoctrinated as to the incomparable superiority of the approach...and could see for ourselves how the reality diverged from the hype. That was a good 20 years ago, but I just ran into a current student who told me that's still the case, and they still hate it as much as we did.

Seems like your university is doing it wrong. While I do believe that the principles used in FP languages are vastly superior I don't think this is really a matter of debate. The advantages are obvious and if you didn't realize it you probably weren't taught well enough. On topic: I sometimes wonder if the wins from FP languages are lost on the people not already scarred by the pitfalls of imperative programming. I w…

That's exactly the kind of hair-raising and mindless (in the truest sense of the word) nonsense we were presented with: "the superiority of FP is not a matter for debate".

The reality was that the tools were slower and buggier than others, the programs different (and slower) but no simpler and the bugs different but stilly just as buggy.

When presented so mindlessly and categorically, any claims of superiority instantly lose credibility. When reality is taken into account, even more so.

Re: Teenage Haskell

#42
post #33

Earlier quoted context omitted.

Who knows, everyone has their own opinion about it. Perhaps it was just too many parentheses for students to deal with.

MIT switched to Python because they believe modern basic CS is about controlling complex systems (web APIs, robot APIs) not walking through the history of CS from scratch and bare metal.

Here are a couple of quotes from 'Realm of Racket', just to expand on your statement:

'All members of this [ALGOL] family are made from more or less the same material and for the same kind of programmers - those who love the machine more than the problem.'

Contrast with Lisp: 'a language that would help programmers solve problems without forcing them to think about the elements of a machine.'

So it really depends on one's interpretation of 'Computer Science', and the choice of what to prioritize from the subject: engineering or ideas.

Re: Teenage Haskell

#43

Earlier quoted context omitted.

> Their lack of preconceptions regarding programming might make Haskell much easier for them to pick up, than it would for a student with experience in another language. Or traumatize them forever away from the field of programming. > Would they think Python was stupid or would they be grateful that all of a sudden they could use a for loop? I would love to know the answer to this, regardless of my own biases. But Ha…

It's an experiment that I'll never run. CS exam requirements are geared towards OO languages. Students have to analyse and write pseudocode using traditional programming constructs.

Here's a relevant comment I made just yesterday: https://news.ycombinator.com/item?id=7956162

In short, Scheme (Racket) is regarded as a superior beginner's language because of its simplicity, together with the ability to explore various paradigms (including OO).

Beginners in Scheme subsequently did better with Java than those who started solely with Java.

I think there's a deep lesson in that...

Re: Teenage Haskell

#44
post #7

I never tried Haskell, or 'functional programming". To be honest, I don't even know what functional programming is. Can someone explain how is it different from Python or C (the only two languages I did little coding with)?

Functional programming is a programming style you can use in most languages. It isn't different from Python or C in the same way that 'murder' isn't different from a chainsaw or a hammer. You can do functional programming in Python or C. It's just not what the authors of those languages had in mind and it's not how the languages are generally used or taught.

Re: Teenage Haskell

#45
post #40

Earlier quoted context omitted.

Seems like your university is doing it wrong. While I do believe that the principles used in FP languages are vastly superior I don't think this is really a matter of debate. The advantages are obvious and if you didn't realize it you probably weren't taught well enough. On topic: I sometimes wonder if the wins from FP languages are lost on the people not already scarred by the pitfalls of imperative programming. I w…

That's exactly the kind of hair-raising and mindless (in the truest sense of the word) nonsense we were presented with: "the superiority of FP is not a matter for debate". The reality was that the tools were slower and buggier than others, the programs different (and slower) but no simpler and the bugs different but stilly just as buggy. When presented so mindlessly and categorically, any claims of superiority instan…

The principles used in FP are actual principles you could employ in imperative languages... and people do, because they are obviously good. It's a matter of there actually being principles instead of the alternative; nothing.

This aside, you seem to be talking about the languages themselves, so let's go ahead:

> the tools were slower

Which tools are these? I don't see this as a systematic failure of FP languages.

Which language were you presented with? Did they explain what you're trading your speed of execution for?

I'm asking these questions because it doesn't really seem like you got it and this supposedly being 20 years later it seems like you're purposefully not getting it. In these discussions I find that a lot of people believe FP proponents to be very unpragmatic, but I find that in most cases, such as this one, there is little to no concession made on the "other side".

Most FP languages are not suitable for performance sensitive tasks and most people will admit this. For most other tasks, though, they're just going to allow you to work faster and get to where you're going with less hassle.

I would like to point out that I'm not saying FP languages are just better overall or that an FP language is always the best choice, but I am saying that the principles they employ and teach undeniably are the best. The alternative isn't as much a principle as it is a lack of principle. Flipping individual switches and modifying memory is just not caring.

Re: Teenage Haskell

#46

My brother (a Haskell programmer) and I (a teacher of high school CS) have talked about this often. He's postulated that teaching Haskell to kids with no programming experience would be an interesting experiment. Their lack of preconceptions regarding programming might make Haskell much easier for them to pick up, than it would for a student with experience in another language. What would be more interesting however,…

> Would they think Python was stupid or would they be grateful that all of a sudden they could use a for loop?

Interesting question. My first language was (Common) Lisp. Not sure if it was a good or bad choice (wasn't a choice really, more of a coincidence), or if those terms even apply. Anyway, I'm fairly certain it took me much longer than necessary to get my first projects done (hint: some of them were never finished). I spent a lot of time trying to express my ideas in a functional style -- avoiding the loop macro, avoiding side-effects whenever possible etc. Slowly but surely drifting away from the actual problems I had set out to solve.

The feeling I got when I discovered Python is very accurately described in that xkcd comic which pops up in your browser when you type "import antigravity" in the interpreter. Then again, if Lisp was a detour on the path to becoming an "efficient and productive programmer", it was certainly a deeply interesting one which left me hungry for more -- I'm learning Haskell now (who isn't?) and am enjoying it immensely.

Re: Teenage Haskell

#47

Earlier quoted context omitted.

It's an experiment that I'll never run. CS exam requirements are geared towards OO languages. Students have to analyse and write pseudocode using traditional programming constructs.

Here's a relevant comment I made just yesterday: https://news.ycombinator.com/item?id=7956162 In short, Scheme (Racket) is regarded as a superior beginner's language because of its simplicity, together with the ability to explore various paradigms (including OO). Beginners in Scheme subsequently did better with Java than those who started solely with Java. I think there's a deep lesson in that...

But scheme/racket is really not that far off from java compared to Haskell. I've never had a hard time working with it, even though I've never learned it formally (ok, two weeks of LISP a long time ago). Racket never felt weird, and many of its API are OO in everything but name, it's like C# with the same amount of FP abstractions (list comprehensions), and maybe some macros and continuations if you want to do something advanced.

But Haskell really is functional programming, there is no way to accidentally create an easy to use OO-style library. And then there are the monads....

Re: Teenage Haskell

#48

My brother (a Haskell programmer) and I (a teacher of high school CS) have talked about this often. He's postulated that teaching Haskell to kids with no programming experience would be an interesting experiment. Their lack of preconceptions regarding programming might make Haskell much easier for them to pick up, than it would for a student with experience in another language. What would be more interesting however,…

> Their lack of preconceptions regarding programming might make Haskell much easier for them to pick up, than it would for a student with experience in another language. Or traumatize them forever away from the field of programming. > Would they think Python was stupid or would they be grateful that all of a sudden they could use a for loop? I would love to know the answer to this, regardless of my own biases. But Ha…

I'm a teen I guess. Haskell as a first language worked great for me, and I happened to write a game and a few scripts in Python two months ago so I think I can answer your question.

So, what made learning Haskell a good experience I think was mainly the strong type system. You could basically even early on use functions you barely knew what its name meant solely based on its type signature. It also made the progress of writing a program very nice, you write it and then it fails, you go back and try fix it, and when it compiles it usually worked.

There are some things to keep in mind though. Wild recursion is really the GOTO of functional languages, it's important to teach how to use the generalized folds and traversals early on. Secondly it is important to have simple analogies to concepts such as functors, monoids and monads etc. If you make sure to not care about these strange names then you can go pretty far by just trying to make the type signatures stick together, and it's not important for a beginner to grasp these directly either.

Python was quite smooth to learn coming from Haskell, the syntax is similar and it simply felt like programming in Haskell's do-blocks. It was very easy to get quickly going, I managed to write a little script talking to a JSON API almost directly after reading the official tutorial. I also digged a little bit into the realm of OOP, I wrote a simple game using Kivy. It felt quite nice actually, I could get some code re-use, although it was harder to get that (as newbie) than in Haskell.

EDIT: Something like typed Racket might been even better when I think about it, since Racket got a lot of resources for complete beginners. Then you get the benefit of easy to use syntax too, although syntax is probably not the biggest problem when starting out. For the record I usually recommend Python or Racket when people ask me where to start, because in the end I don't think it matter much what language you go with first, just make sure not to limit the paradigm of languages you learn afterwards.

Re: Teenage Haskell

#49
post #33

Earlier quoted context omitted.

MIT switched to Python because they believe modern basic CS is about controlling complex systems (web APIs, robot APIs) not walking through the history of CS from scratch and bare metal.

Here are a couple of quotes from 'Realm of Racket', just to expand on your statement: 'All members of this [ALGOL] family are made from more or less the same material and for the same kind of programmers - those who love the machine more than the problem.' Contrast with Lisp: 'a language that would help programmers solve problems without forcing them to think about the elements of a machine.' So it really depends on…

That is an incredibly condescending way of arguing. On the other side of the coin you could claim that imperative programming is more practical, concerned with the actual steps needed to solve a problem, instead of an ideal, indirect formulation. Imagine having to explain someone how to bake an apple pie without being able to state any specific steps how to do it but instead describing the pie as some set of interrelationships of the ingredients. (That is probably not a fair characterization of FP, but it's at the same level as "[imperative programmars] love the machine").

Re: Teenage Haskell

#50
post #45

Earlier quoted context omitted.

That's exactly the kind of hair-raising and mindless (in the truest sense of the word) nonsense we were presented with: "the superiority of FP is not a matter for debate". The reality was that the tools were slower and buggier than others, the programs different (and slower) but no simpler and the bugs different but stilly just as buggy. When presented so mindlessly and categorically, any claims of superiority instan…

The principles used in FP are actual principles you could employ in imperative languages... and people do, because they are obviously good. It's a matter of there actually being principles instead of the alternative; nothing . This aside, you seem to be talking about the languages themselves, so let's go ahead: > the tools were slower Which tools are these? I don't see this as a systematic failure of FP languages. Wh…

Wow, the arrogance and ignorance is just incredible, just the way I remember. :-) Someone who doesn't buy into your highly constrained world-view must obviously be ignorant.

"doesn't seem like you got it" ... "purposefully not getting it" ... "principles [..] undeniably the best".

No, you like those principles best, and that's about the most you can say. We don't even have solid criteria with which to make that call, never mind there being any type of consensus as to which is "best" (except within specific communities, but with each community having a different consensus and the most closed-minded of these communities usually the most sure of themselves).

Just to head off more ignorant comments: I aced those courses, as well as a few more including the elective "foundations of FP" and did my oral exam on Backus's FP calculus, which inspired me to come up with Higher Order Messaging: http://en.wikipedia.org/wiki/Higher_order_message

I also did some courses on algebraic specification and graph grammars (related to category theory), as well as formal specification with Z (yes, aced those as well). While useful in certain very constrained areas, these techniques trade making the smaller problem better (spec -> code) for making the larger problem ( actual problem -> spec ) infinitely worse.

Of course, functional techniques are a part of my toolbox, as they should be for any professional. However, if they were the only contents or even the majority of my toolbox, I couldn't do what I do and have been doing for the last quarter century.

Post reply on HN