Hacker News new | ask | show | jobs
by BucketSort 2675 days ago
Related: Dijkstra's comments on mathematics and CS - http://www.cs.utexas.edu/users/EWD/transcriptions/EWD12xx/EW....

I've personally been getting a lot of satisfaction from learning Haskell and seeing how the functional programming community is taking ideas from abstract mathematics, like category theory, and is turning them into practical ways of thinking about programming.

2 comments

Me too. Listened to a podcast recently where they were talking about things like, "once you know what a monoid is, you start seeing them everywhere". I've tried to express these benefits to coworkers recently. Leveraging ideas from math allows you to take advantage of many decades of research and provides a structural foundation that's substantially more robust than things you might find in the gang of four book or other "design pattern" resources. I think there's still a lot of opportunity to bring these ideas to the masses in the way that Evan Czaplicki , the author of Elm, is trying to do. The challenge in doing so seems to be finding the right level of abstraction to expose people to with the goal of maximizing benefit while simultaneously minimizing the prerequisite knowledge you're requiring folks to take on to participate.
I think it depends on what you are doing. If you are just doing API plumbing, the idea of introducing more rigor into the process may seem somewhat absurd. If you are doing real programming, however, Haskell allows you to elegantly structure and think about a problem. Certainly in parsing applications Haskell is a no brainier, Pandoc is written in Haskell for example. People are saying Rust is going to be the chosen one that brings it all together.

For anyone interested in Haskell, I recommend starting with http://learnyouahaskell.com/ (very friendly, intuitive and light) then doing these exercises: https://github.com/data61/fp-course.

I'm mostly in agreement with you with the caveat that I've seen lots of "throwaway code" turn into production code that folks end up depending on. These days, if something seems like it has even a remote chance of being adopted into a production system, I'll try to make sure that it's on a solid foundation.

Also, in terms of learning Haskell and its cousins, my advice is to start building stuff right away. It's easy to read about this stuff almost endlessly and never do anything productive with any of it. After learning Haskell, I got into Elm and then later PureScript. PureScript has really opened the door for me regarding getting some of these concepts out into the real world. It's really fun and feels rewarding to actually take advantage of some of the constructs that seemed pretty alien and abstract for a long time.

It is actually quite important to read up on Haskell if you don't have a background in modern FP. It isn't like other languages where you just see what's different from what you already know. There's a lot of conceptual stuff that helps understand what's going on. I actually started by jumping in myself, so I just wrote programs that were quite bad in Haskell terms. I usually recommend jumping into a language right away too, but it really really helps to understand some Haskell concepts at a conceptual level that is hard to understand from just jumping into the code. If one wants to jump right in, they can just do that FP course which is all exercises and skip the book, but I assure you that most noobs will be completely lost. It's like starting someone off in calculus with derivatives, completely skipping over limits and the geometrical underpinnings.
I should clarify that by "jumping in", I'm suggesting getting to a structural foundation that includes monads, applicative functors, monads, and their ilk, and then moving into writing code. I say this because I spent a few years learning this stuff without doing anything remotely practical, and I think that's too long.
Isn't the book you linked a bit dated?
LYAH is a bit dated, but since it focuses a lot more on conceptual stuff, instead of being directly pragmatic, it has aged a lot better than books like "Real World Haskell".
The main concepts are presented well, but people have complained about it being dated. What in particular do you find outdated?
I saw someone confused on haskell-cafe yesterday because it doesn't cover Applicative so their Monad instance was invalid.
Oof that is bad. I admit that I only used it to learn the basic concepts that just did exercises and read the prelude documentation ( which is fantastic ). Thanks for letting me know.
What's the name of the podcast?
The Haskell Cast. This is the episode I was referring to. It's pretty good.

https://www.youtube.com/watch?v=O3EjNRgypXg

"practical" is highly debated.