Live data from Hacker News

Basics of Haskell – Code and exercises

github.com

31–40 of 47 posts

Re: Basics of Haskell – Code and exercises

#31
post #4

Writing interpreters in Haskell (which is what some of the lessons seem to be about) is a great way to learn the language. It naturally motivates recursion, algebraic data types, strong types, higher-order functions and later, when effects such as state and errors are needed, monads arise naturally. The best part? It takes a ridiculously small amount of code to do all that, maybe around a hundred or less. Languages w…

Back when I did my degree, Haskell still wasn't a thing, like it was giving its first steps.

So the choice would be Lisp, Prolog, Caml Light, or the recently released Objective Caml.

The year before I took compilers design project, the TA responsible for it used to disallow them from the implementation language option list, as it would make the assignment too easy.

Re: Basics of Haskell – Code and exercises

#32
post #3

My university teaches the intro CS course in Racket (lisp), and I know another that teaches in Haskell. If decades of priority exposure to young programmers is not enough to spur widespread adoption, then I'm not hopeful.

I think intro CS courses in Lisp and Haskell (or other less-than-mainstream languages) hurts the uptake of those languages. The students will confuse the difficulty of the material with the language itself. And there's less material out there to support them, compared to the multitude of Q&As for C or Java or C++. And when later courses move them to other languages (C, Java, C++, etc.) things seem easier so the stude…

When I did my degree, we had ISO Pascal and C++ (proper C++ not C with classes) on the 2nd year (1st was a common year to all engineering degrees),

Followed by abstract logic, Prolog, Caml Light and Smalltalk on the 3rd.

By the 4 year, you would have used Prolog in a couple of parallel assignments that also required it, Lisp via ELisp, as Emacs was the "IDE" for the Prolog and Caml Light assignments and some TAs liked to spend an hour introduction to not using Emacs like Notepad.

UNIX systems programming, distributed computing, data structures and algorithms would make use of C, that by virtue of having already learned C++, no teacher would spend a second with an introduction to C lectures.

Those of us that took language design and compilers, would still delve into proper Lisp, Cobol, Fortran, Algol, Oberon, and a couple of others even less known. The teacher driving this lectures would switch back to Caml Light for several exercises.

Since I ended up graduating as Java came into the scene, the very last year I ended up doing several projects in Java as well, while taking place in the national championship of logic programming.

If anything what frustrated me was coming into the market place and having to deal with C, while having been exposed how much better the things could be. Thankfully using it alongside Tcl made it not so bad, given Tcl's lispy background.

The problem is not the intro courses, the problem are the teachers and the material been given to the students. It isn't a big deal if there aren't many books available, when there are teaching notes (of book like quality) given by the responsible professor, which one can question at any time unlike most book authors.

For me what made the difference weren't the books, rather the teachers I had the luck to meet during my university travel.

Re: Basics of Haskell – Code and exercises

#33
post #3

My university teaches the intro CS course in Racket (lisp), and I know another that teaches in Haskell. If decades of priority exposure to young programmers is not enough to spur widespread adoption, then I'm not hopeful.

I think most programmers aren't actually coming from university currently.

I think most HR departments would see it otherwise, specially in most European countries.

Re: Basics of Haskell – Code and exercises

#34

Would it not be great if instead of a programming language being handed down to us as if made of stone, it was seen as a particular expression of a set of ideas (some good, some bad), much as music is, that we could relate and respond to in the same spirit?

Sounds like you are talking of lisp.

Re: Basics of Haskell – Code and exercises

#35
post #13

Bartosz is always doing great stuff. Check out is Category Theory lectures for people who know Haskell: https://www.youtube.com/user/DrBartosz

Indeed, also a big fan of his category theory for programmers https://bartoszmilewski.com/2014/10/28/category-theory-for-p...

I’m a huge fan, but I struggled. And I studied math! The super abstract stuff I find hard. Once the categories become arrows themselves: I’m lost!

Re: Basics of Haskell – Code and exercises

#36

Earlier quoted context omitted.

Many people who like scheme and functional languages have an averse reaction to more procedural or OOP languages. It's interesting that people don't grok it can go the other way. But this is HN so I guess I'll explain. A few things (and for context this was 1996). With the class I disliked they were trying to teach me a language and a complex concept at the same time. In a 4 month semester, half of it was spent just…

You’re not alone. My brain works in steps, not proofs. If all code looked like Haskell and friends I doubt I’d ever have gotten into it in the first place. [edit] algos, over proofs, would probably be a better way to put it.

Proofs work in steps too.

I can never tell what an index-juggling loop is doing, in whatever language (including Scheme).

But when you follow the data type case by case, each step is simple and logical, easy to comprehend so the whole solution is easy too.

Re: Basics of Haskell – Code and exercises

#37

Would it not be great if instead of a programming language being handed down to us as if made of stone, it was seen as a particular expression of a set of ideas (some good, some bad), much as music is, that we could relate and respond to in the same spirit?

i think a better analogy would be [programming techniques as "musical ideas", programming languages as instruments]. you can pick an instrument that fits what want to do, or build a new one if you know how :)

Re: Basics of Haskell – Code and exercises

#39
post #36

Earlier quoted context omitted.

You’re not alone. My brain works in steps, not proofs. If all code looked like Haskell and friends I doubt I’d ever have gotten into it in the first place. [edit] algos, over proofs, would probably be a better way to put it.

Proofs work in steps too. I can never tell what an index-juggling loop is doing, in whatever language (including Scheme). But when you follow the data type case by case, each step is simple and logical, easy to comprehend so the whole solution is easy too.

Sure, which is why I edited that “algorithms” is more accurate. When I read proofs I have to go through each step and figure out what every term on either side “does” to something “going through” it to make sense of it. I’d rather have my sandwich-making instructions as instructions than a series of statements about how the sandwich looks at each stage that I have to go back and turn into instructions to actually do anything with it, if that makes sense.

I get that other people don’t have this preference, but I strongly do. Test results indicate I should be incredibly well suited to mathematical work but I feel the way I imagine a dyslexic must when I try to read math or “mathy” programming languages. Give me something more-or-less procedural and I’m totally happy (though I gather I had a much easier time understanding and getting comfortable with recursion than many people do, which seems weird given I find the languages most heavily associated with it almost unreadable).

Re: Basics of Haskell – Code and exercises

#40

Would it not be great if instead of a programming language being handed down to us as if made of stone, it was seen as a particular expression of a set of ideas (some good, some bad), much as music is, that we could relate and respond to in the same spirit?

The programming course at my university taught us the fundamental paradigmens. The languages were chosen only as examples.

Imperativ / OOP => Java

Functional => Haskell

Logic => Prolgo

Post reply on HN