Hacker News new | comments | ask | show | jobs | submit login
Learn You a Haskell for Great Good (learnyouahaskell.com)
322 points by tosh 6 months ago | hide | past | web | favorite | 145 comments



I tried LYAH before I had any real functional experience, and it went poorly. I think I wasn't dedicated enough.

I took a programming languages class taught in Racket, and by the end of that semester I felt like I had finally "gotten" what functional programming was all about.

Tried LYAH again and... it still didn't quite stick. Not sure why. But I was determined, because I'd heard about Haskell so much on the internet.

So I took a follow-up "class" where we just implemented projects in the functional languages of our choice, and I chose to do everything in Haskell. I asked my research advisor (I work in a PL research lab) for guidance, and that's when Haskell really started to make sense for me. I'm not sure why LYAH wasn't good for me, when it's touted as being a great starting place for so many people, but now Haskell is one of my favorite languages by far.


> I'm not sure why LYAH wasn't good for me, when it's touted as being a great starting place

It's not. It's a terrible starting resource. Majority of people I anecdotally hear gave up on Haskell seem to mention LYAH. Yes the material is there, but it's not presented in a way that generally sticks and fits pieces together. I guarantee someone will reply to this thread and say it worked for them, but in general people seem to be unsuccessful with it.

There are better options out there.


I think the enthusiasm for LYAH should also be seen in context.

Real World Haskell was the first book that made it to a wider audience. And while was is full of useful information, it is a very uneven book that works badly as an introduction to Haskell. We once had a reading group where we read RWH, most colleagues dropped out after the first 3-4 chapters.

In comparison, LYAH was a book that was far more straightforward as an introduction. And I know a few people that have gone through it cover to cover.

Although it's been a while since I read it, I really liked Graham Hutton's 'Programming in Haskell'. It was short & clear.


Hutton's book was my favourite too when I was learning Haskell. My only gripe was it used a proper typeface for it's code samples, making mapping to keyboard strokes an unnecessary cognitive effort.


>Majority of people I anecdotally hear gave up on Haskell seem to mention LYAH

This is a bad statistic to use on its own. Imagine if I said "Majority of people I anecdotally hear gave up on web development seem to mention HTML". See the problem?


HTML is by definition intrinsic to Web development.

LYAH is not intrinsic to Haskell programming.


Let me try to make hexane360's point more explicitly:

Imagine a hypothetical universe where all Haskell books are equally good, but some are more popular than others (maybe they have well known authors, or catchy titles, or are available for free online, or something). In particular, imagine Haskell Book Number 7 (HB#7 for short) gets 99% "market share".

Then if someone says "most people who gave up on Haskell used this book", you should not conclude that it reflects badly on the book. It's just a consequence of the book being popular, so it's the one people tend to try to use, so it's "the one that didn't work for them".

If you want to learn whether the book is better or worse than average, you need to split people into two groups: one group used this book, the other group used some other book, and compare which group does better. (Ideally, you should assign people to a group based on a coin flip, but even just looking at what happens "naturally" without your interference is better than nothing.)

Back to our non-hypothetical universe: LYAH does not have 99% market share, but it's pretty popular. I heard of it, and I've never looked for a book on Haskell. So to some extent the same logic applies.


I see what you're saying, and it makes some sense.

As you say, though, LYAH is almost certainly not at 99% market share. It's definitely not at the 100% market share HTML has in Web development.

The universe is too complex to design a statistically-valid study for everything you want to know (though I definitely understand the urge to do that). At the end of the day, anecdotal evidence may not be great, but it's often better than nothing, and nothing is often the only other practical option.


> better than nothing, [which is sometimes the only other option]

True. The trick is to sort of mentally keep track of how much better than nothing it is, so you know which pieces of anecdotal evidence you can trust with only 40% confidence, and which you can trust with something more like 90%.

But yeah, definitely WAY better than nothing.


I had a very similar experience with the "Poignant Guide To Ruby" back in the day. It had an enormous cult following, it's a charming piece of programming-themed art, and probably did a lot to encourage people to want to learn the language, but I found it wasn't actually very practical as a tool for learning.


What would you recommend?


I would start with Haskell Programming from first principles, as it is recommended by many and it looks good (I have to admit I started with LYAH but content-wise, HPFFP is much better).

I also recommend reading these web documents as a supplement:

http://dev.stephendiehl.com/hask/

https://wiki.haskell.org/All_About_Monads

https://wiki.haskell.org/Typeclassopedia

https://www.fpcomplete.com/blog/2017/09/all-about-strictness

I am now reading Haskell High Performance Programming (https://www.packtpub.com/application-development/haskell-hig...), and while the book is more intermediate (it assumes that you can find the documentation and read the Haskell code yourself), I think it is a good overview of how to use modern Haskell in real projects.


Easily the best one IMO: http://haskellbook.com/ . Unlike LYAH it covers stuff that is actually important to writing real haskell programs like testing code, managing effects via monad transformers, etc.

Also this is one of the best references while you're learning (not good as a tutorial, but chock full of invaluable resources): http://dev.stephendiehl.com/hask/ . TBH I wish every language had an equivalent of this guide.


Haskell Programming From First Principles is costly but extremely good: http://haskellbook.com/

The beginner material in the Haskell WikiBook is pretty solid: https://en.wikibooks.org/wiki/Haskell


found this[1] to be a great introductory course. Might want to have dipped into functional concepts beforehand, though.

Fairly sure it was recommended in here in the past and that's how I came to know it, can't give credit because I sadly don't remember.

[1]https://www.seas.upenn.edu/~cis194/spring13/lectures.html


Another entry in the not Haskell category, Functional Programming in Scala is outstanding.


Yes, this book is one I recommend to anyone who wants to really understand functional programming. Admittedly it's not Haskell, but it's the book I wished I'd had back when I first learn FP (and Scala).


It lost me about 2/3 in when it got to monads.


That's OK. You've already learned more than enough. My life in Scala was just fine once I understood that a monad was just a data type that admitted a flatmap operation.


the spring 2013 edition of cis194[0] seems to be the most commonly recommended from previous threads here. due to its popularity a quick web search leads to a lot of secondary learning resources if you get stuck. i'm currently most of the way through it and it's been well presented and nicely challenging.

[0]http://www.cis.upenn.edu/~cis194/spring13/lectures.html


I learned Haskell from the "Gentle Introduction" (which isn't so gentle), then writing programs, reading documentation, and reading online discussions and threads.

https://www.haskell.org/tutorial/


I'm not OP and it's not haskell, but fsharpforfunandprofit.com really clicked for me, personally.


Real World OCaml is great.

While not purely functional, I also recommend JacaScript Allongé.

Both are free online!


I really enjoyed programming in Elm as a starting point. Elm avoids type-classes, which tend to be the biggest hurdle when starting to learn Haskell. Plus, you can design a nice web app in the process (versus, say, process CSV files). After I became comfortable with Elm, learning Haskell, type-classes, lazy evaluation, etc., made significantly more sense to me. For instance, `do` syntax is great, but it's not obvious what it really is doing, at first, unless you've programmed pure functional languages without using `do`.

Also, learning Idris is another great learning exercise if you want to stretch the ways to think about programming.


Learning Idris will definitely alter the way you think about programming and make you a better programmer, even if you don't program in it on a daily basis.


Can you give a little more info? Does it offer alot over Haskell?


Dependent types


I've bounced off LYAH more than once because it spends so much time in the REPL. I'm not interested in the REPL as an end in itself, only insofar as it can help me develop an actual program. Outside of image-based environments, what you do in the interactive shell doesn't reflect how actual code gets written. It feels trivial, and it doesn't help you build up a library of examples to refer back to later.


This bothered me too. I use a REPL everyday, but you have to know how to write full programs too.


What book on any language shows you whole programs that couldn't be seen in repl (assuming a repl exists)


Off the top of my head, HtDP, despite being entirely presented within DrRacket, has you work through programs that you could just as well compile. Learn Python the Hard Way, as well as every other "Hard Way" book, makes a point of having you write entire programs. The Ocaml resource that was posted a week or two ago makes a point of deemphasizing the REPL.


I have over 25 programming books in my cube and another dozen or so at home. I'd say roughly 1/3 tend to favor full practical programs interlaced with snippets. The full programs are usually 1/2 to a few pages in each chapter and are in general, not something I'd try to cram into the REPL piece by piece.


I concur. LYAH may be seen as an intuitive and easy read for getting started but I felt I was incapable of understanding real Haskell code with just that background. I finally got my hands dirty by hacking around on existing Haskell code which is when things started making sense.


Are there any similar resources with practical examples (other than the book Real World Haskell)?


LYAH was my first taste of functional programming. Before that I only had 2-3 years of experience using PHP and Ruby. I read this book and quickly fell in love with FP and category theory, for the first time really started to enjoy programming to the fullest. This book is also the reason I was able to land a job as an Erlang developer, and teach a little bit of Haskell to others. Now, 5 years later, I continue my studies with languages such as Emacs Lisp, Guile, Clojure, Elixir, Elm, Hy.

I know this book isn't really popular (reading these comments) but to me it holds a lot of emotional value and I felt obligated to share my experience. I'll always be grateful for what this book taught me, and thankful to Miran for writing it.


> to me it holds a lot of emotional value

For me too. I had some experience of FP and was also a PHP programmer. It's one of the funniest programming books I've ever read, references to Avril Lavigne amongst category theory appeals to my sort, but clearly it's not a book for everyone.

So I found it fun to learn and the concept of Applicative Functors in between Monoids and Monads has stuck. As well as the examples of monads, such as walking on a tight rope with birds landing either side.

I'm still not doing pure FP and so I forget much of the content, but its a pleasure to pick up and re-read.


What are you building with Erlang? If you don't mind sharing. I always love hearing about it being used in production... Usually it's used in interesting ways. Unfortunately not to many jobs available (not that I've tried very hard to find one).


We use Erlang to build Kazoo (https://github.com/2600hz/kazoo). In production since 2011, deployed around the world in various clusters.


Another good (imho better) option is the Haskell book https://haskellbook.com/


Not to start a flame war, but imho this is my definition of a "terrible book". Of the everything and the kitchen sink variety. By contrast, I very much enjoyed LYAH, not least for its self-effacing humor. Hutton was too dry for me. There's a less well-known "Thinking Functionally with Haskell" book by Richard Bird that is concise and targets the mathematically inclined crowd.


It is something that is marketed very well. From the sample content, It didn't look interesting to me at all.

LYAH may not be the greatest Haskell tutorial. But it makes an easy read. That means, you are not afraid to go back to it again and again, Which is the crucial aspect of learning anything sufficiently complex or new or both..


I agree re: marketing -- something I had easily fell for. One of the authors has moved onto writing another Haskell book (a "work of art" apparently), but this time my interest, for an intermediate level book, is elsewhere: https://intermediatehaskell.com/ (which would be more informative--thus pedagogically sound--than a work of art).

Lesson learned: don't fall for the marketing of art.

Generally the best way to learn is by actually doing projects: http://www.haskellforall.com/2017/10/advice-for-haskell-begi...


Why is "everything and the kitchen sink" terrible? Thoroughness is appealing. You aren't obligated to read all of it.


I personally favor thin books that present what really matters after having digested it first. Not that there's no place for thick books on my shelves (CLRS among others). I find HaskellWiki/Hoogle better serve the use case that the Haskell Book seems to target.


He of functional programming with bananas etc.?


I can't recommend this book highly enough. Very practical, and the way the chapters are organized really feels right. The excercises and examples really help drive the concepts home.

In my opinion, Learn You A Haskell is a poor resource to learn the language and for some readers seems to be actually counterproductive (I have two friends who got through LYAH and then tried actually using Haskell, realized they have no idea how to actually use the language, and give up on Haskell altogether :( If only they'd used The Haskell Book...)


I read more than half of this book, and sadly I did not enjoy it at all. Read it only if you enjoy long-winded verbose explanations. Hutton's or Bird's is concise yet explanatory.


It was valuable to me as pretty much the only Haskell resource I read that addressed more complex concepts without hitting a point where they needed to resort to mathematics.


I've never had to resort to mathematics (like category theory) when learning to use Haskell in real-world projects. And I don't think Hutton's or Bird's rely on mathematics for teaching Haskell.


Can you give me one such example?


Does the verbosity interfere or can you skip over details you don't need?


Well, if you are reading the chapter, it's because you want to understand it. Since everything in this book is verbose, you can't just skip the verbose parts.

Half the examples contain jokes or cutesy animal sounds (onomatopoeia). I like jokes, but it is distracting me. Especially when I don't understand the cultural reference.

My biggest gripe with the book is that the examples can feel quite contrived. Its probably super hard to make a book featuring all concepts without having contrived examples. But I remember reading a chapter and some arbitrary abstraction is introduced. Problem is, based on that example, I don't realize when the abstraction is useful.

It might be impossible to write a Haskell book that is neither terse not unnecessarily verbose.

Since you can get some chapters for free, I'd recommend you just download them and see if you like the style.


Currently:

>This site can’t be reached >haskellbook.com refused to connect.

HN readers hitting the site?


http version is up and running. maybe it's just a certificate thing: http://haskellbook.com/


That link works, thanks.


It seems that it's development is stagnating, no visible updates for a long time, though I'm eagerly waiting for the release of it's final printed edition.


The book is functionally complete. We're not waiting on any new chapters or anything. If you want a printed edition I wouldn't wait. The digital version is very good though.


I wouldn’t hold your breath. Julie stopped work on it a long time ago. It’s pretty good as is though.


afaik all the chapters are written. the version you get on gumroad is final.


Agreed. Now that I found I like org-mode plus org-babel-tangle I'm planning to re-read it solving the exercises.

LYAH however is a few days read. It lets you to get closer to start learning haskell, but not even in the same league.


Very good book! Definitely the best one out there


But it costs $59 dollars, and you don't have the option of buying a print book.

LYAH is more appealing for early learners, since it's free.


The Haskell wikibook[1] is a better free resource.

[1]: https://wikibooks.org/wiki/Haskell


for others that run into problems with the link: it does not work with https:// (at least for me)

Change it to http://www.haskellbook.com


LYAH also didn't do much for me.

I got started with Haskell Data Analysis Cookbook. As an experienced programmer, I LOVE the "cookbook" format. E.g., "Keeping and representing data from a CSV file" or "Examining a JSON file with the aeson package". If you need to actually USE the language, this is a great way to get started. Complete programs are shown.

Unfortunately, most books dive into the language _implementation_ instead of teaching its _interface_. (This probably points to a Haskell design weakness: deep learning of the impl. is nec. for success.)

But my REAL wish: Because I'm like many people and have experience with dozens of languages. I want books that leverage that knowledge and experience. E.g., to explain monads, just say it's an interface specification, and give the API. It'll make sense to me.


> But my REAL wish: Because I'm like many people and have experience with dozens of languages. I want books that leverage that knowledge and experience. E.g., to explain monads, just say it's an interface specification, and give the API. It'll make sense to me.

I understand the wish but I personally believe it is a bad idea. I think Haskell is just too different due to purity and laziness and trying to adapt your intuitions from imperative programming is going to mostly fail, badly. I suggest it's better to approach Haskell with a completely blank mind and learn the correct intuitions through just being very rigorous at the beginning.

I have written a bit of Haskell myself but I still get surprised by evaluation order, for example. But it has paid off, I think, it's a lot more understandable and modular and beautiful code that I write in Haskell than elsewhere.


This is my all-time favorite Haskell resource: https://en.wikibooks.org/wiki/Haskell

Just jump to the bottom and go through as many pages as possible. Going through Functors, Applicatives, and only then Monads puts everything in a broader context and makes Monads easier to understand.


Still recall the advice form a classmate asking if I should learn Haskell -- he said "Just learn it because it'll change how you think about programming".

I think people should learn it for this exact reason -- it really does change how you program as well as thinking about programming even if on a daily basis you're not writing pure Haskell or Clean or Scheme or whatnot.

Common programming concepts like "iteration", "state", "formal methods", "parrallellism" are concepts that functional programming makes you reconsider from a new perspective.


I always think that this attitude is a little bit off. Obviously learning a new paradigm or a new language is great and expanding your horizon is very rarely bad, but I feel a little bit sad about shoehorning Haskell, or functional languages in general, still into this education category.

Haskell is a very solid production language and you can put industrial grade software in Haskell out there, and it is in fact used by a fairly serious amount of companies at this point.

Instead of just taking Haskell features and porting them into already adopted languages, I'd really like to see more companies just go directly with Haskell, or Clojure, or Ocaml and F#. It does work.


I'm with you on Functional Languages being solid and useful, I've done quite a lot of work in Standard ML, but the parent's point wasn't only do it for the education, it was at least do it for the education.


> Instead of just taking Haskell features and porting them > into already adopted languages, I'd really like to see > more companies just go directly with Haskell, [...]

Unfortunately there are some places where aspects of the standard infrastructure around Haskell block production application.

In particular, we have applications with very hard latency requirements and also with complex type/binding requirements (where a direct structural type system is needed):

https://github.com/Morgan-Stanley/hobbes


I think one of the most important things I learned from functional programming was how to consider and handle purity and side effects.

Not necessarily by wrapping everything in IO monads in my non-functional code or anything like that. But trying to keep bits of business logic in pure functions (where possible, of course) sure makes my job easier.


Yeah but you don't have to learn Haskell to understand that


It's very easy to give up in other languages. Haskell forces you to find a pure way by giving you no other alternative - and most of the time, a pure way is actually easy once you try.


Based on my experiences using this as a reference while taking a class on functional programming, I think that while many of the explanations and examples are helpful, the ordering is a bit weird. For example, pushing off the explanation of higher-order functions for so long seems questionable, since they're a fundamental feature of the language.


I agree, it's really disjointed. It spends a long time on relatively easy stuff and not much time on the hard things, IMO. I also have trouble with the style and I think it goes too far with the sort of informal, conversational tone. Ultimately Haskell is a language with a lot of formality at its core. You don't have to present it as all abstract category theory theorems and such, but that doesn't mean you should avoid formality entirely.


What do people think of Real Word Haskell (http://book.realworldhaskell.org/) ?


Excellent except that it is dated. GHC, libraries, and tooling have moved on in ten+ years. I would buy a new edition instantly.


It's what I learned with. I thought it was pretty good, but I haven't tried any others. It gets you started, and seems best for a reader who knows a few other languages.


Many years after my first exposure to this book and having learned more heavy-FP in Scala, I would not recommend this as a resource for learning either FP or Haskell.

But let that not be a pock on the overall great mission to make FP more accessible.


Haskell is hard, mainly because it's normally not a first language, and the first language people learn probably has Algol-like syntax (e.g. C, Java). I think Erlang is a bit easier to learn due to having fewer features, and for me was the gateway drug to Haskell. It let me learn to program with recursion instead of loops, and pattern matching instead of `if`s. The type system is the best part of Haskell, but unfortunately it makes it very easy to get stuck when starting out ("IO String" vs "String", "ByteString" vs "Text"). It's well worth the investment, though, to get a tool that lets you develop concise code like Python/Ruby but gives you strong guarantees of correctness. Also worth noting the incredible ecosystem of libraries and tooling, like stack and intero:

- https://docs.haskellstack.org

- https://commercialhaskell.github.io/intero/


I wouldn't really consider stack to be a great tool. There is Stackage which may be useful but the tool itself falls apart quickly when used to compile more than a single package executable.

That being said, one should have looked at these:

  - cabal Nix-style builds
  - ghicd for continuous type-checking
  - stylish-haskell for light code formatting
  - brittany for slightly more invasive code formatting
  - hlint for linting


I don't think Haskell is hard, but that's once you know it. It takes a lot of insights until you can see that it is really simple. A lot of code can look unreadable but that's just until you become familiar with the idioms.


I read LYAH a few years ago and I enjoyed it. These days I'd probably find it tries too hard to be funny, but that's me getting older, not the book getting worse.

It is very much written by a (young) 20-something targeting other 20-somethings with a similar sense of humor. Came out in 2011, which puts the author at 24 years old. So ... you know.

Went to high school with the dude for 4 years. He's cool.


I wish this was shared less, it does a really bad job at teaching practical Haskell skills. For a long time this book left me with the feeling that I was unable to learn the language.


People have different styles of learning. I loved LYaHfGG, but hated Haskell Programming from First Principles. As is evident from this thread, many others feel the opposite way. Both books deserve to exist and be shared frequently.


What about "Get Programming with Haskell"[0] from Manning. Is it any good?

  [0]https://www.manning.com/books/get-programming-with-haskell


Yes, the book is true to its title.


It doesn’t seem to be the most popular opinion around, but I must say I got back into FP (which I came to profoundly despise after completing my CS education) thanks to this book.

It’s certainly not a book for the profane, despite its approachable aspect.


I read LYAH and enjoyed it. But I did play around with Haskell a lot at the same time.

In addition, the IRC channel was immensely helpful along the way.

Nowadays I just use haskell for a few things at work or for toy projects, and the initial steps were taken with LYAH. (Beginner level though and I think I learned more from irc than the book in the end)


I won't comment the book. But my personal feeling is that you need a working environment first. And for that, you need to follow the advice at this resource: https://medium.com/@dogwith1eye/setting-up-haskell-in-vs-cod... with my comment (cf Olivier Rossel). If you are under Ubuntu, forget about the brew paragraph. Just curl -sSL https://get.haskellstack.org/ | sh

After all that, you will have an editor that can run/debug some Haskell.


I will quote (what i think is) an important part of the learning process: "Much of the difficulty in learning a new language is simply setting up the environment and getting comfortable with the tools to start programming." Having a kind of IDE to play around was immenselly useful in my case. I then could try to solve small problem i invented. And used the various Haskell resources in a non-linear way (how to do this? Cf SO, books, articles, etc. And then some theory articles to tell you why it is done this way. And that again for another topic required to solve my problem, and again, and again). Problem solving was my way to go to discover the Haskell way. Not just reading a book linearly.


First programming book I've ever read. I love it. I haven't done Haskell since.


It seems obvious to me that LYAH is an imitation of Why's Poignant Guide to Ruby, and that neither is actually a good learning resource. I don't mean to disparage these as works of art, but _why did it first, _why did it better, and if you actually want to learn either ruby or haskell neither should be your first stop.


Yeah, I'm as much a fan of whimsy as the next guy, but every language wanting one of these twee storybook intros is increasingly grating (Clojure has Clojure for the Brave and True etc).


Wouldn't be my first recommendation for a good Haskell book. I really enjoyed Haskell: first principles. I'm sure that will get mentioned a lot here.

Still, as a free resource it does cover some fun things. I just felt the book wasn't practical.


Honestly, this is not a good book for beginner.

Here are some FREE Functional Programming (Haskell,Purescript)learning resources from 101 to building product: https://github.com/functionalflow/brains/projects/9

More, over 20 FREE FP books: https://github.com/allenleein/brains/tree/master/Zen-of-Func...


I don't recommend Learn you a Haskell or Real World Haskell. Check out Haskell Programming from First Principles


I got about 2/3rds through this and I didn't like the lack of exercises or real example programs.


Terrible book. Please, please read Graham Hutton's Programming in Haskell. LYAH is full of incorrect definitions and broken analogies. Hutton on the other hand is up there with K&R for clear and concise definitions.


> Terrible book.

Definitely overstated and not good advice for beginners.

My advice to beginners would be:

- Read all the Haskell books available at your disposal. (In addition to LYAH and the Hutton book, I would say Learning Haskell From First Principles and Get Programming with Haskell are great, https://www.manning.com/books/get-programming-with-haskell, http://haskellbook.com/)

- When you hit something that doesn't make sense in one source, try referencing it in another source.

- When you have some experience writing programs in Haskell, refer to some older books like Real World Haskell. There may be a few issues compiling the examples, but nearly all the techniques in the book are still widely used and you learn about the language has progressed in the last few years. This gives you a compass to read and maintain older Haskell source code).

- Read as much Haskell code as you can from popular libraries (Pandoc, XMonad, and smaller libs as well).


Beginners want a clear place to start learning from. All those things you said are overwhelming and unnecessary. Some of your recommendations would be fine as next steps, but to start with, just read Hutton's book. It is small enough to be read in just a few days.


I think there are two different definitions of "beginner" being used here.

1. Someone who has never programmed before, and is perhaps young. Someone who has to be guided. A novice.

2. Someone who is new to this particular language, but is experienced at programming generally; who is attempting to learn the language to use it "in anger" (i.e. with a specific goal in mind and a timeline for that goal); and who is willing to "do whatever it takes" to learn the skill. A journeyman beginning a new path.

A novice needs a definitive textbook. A journeyman-beginner, on the other hand, needs definitive primary sources, however scattered.

If you're a high-school student learning precalculus, what do you need? A math textbook.

If you're a post-graduate student learning some specific arcane sub-discipline of math to see whether it could be used to solve the novel problem you've decided to do your thesis on, what do you need? Primary sources. All the journal papers in that field you can get your hands on. There's no one textbook that could possibly help you; the only truth you will find is the truth "between the lines" of everything you read.


I think this is good advice for learning any topic in general. Learn from a diverse range of sources.

When I was first learning to code I can remember deciding to stick with one learning resource so as to not overwhelm myself. Eventually I hit a road block and wasn’t able to push past it. I blamed myself for not being able to understand what I was reading. I wasn’t smart enough.

When I tried again years later, instead of sticking with one resource I flicked between several different ones at once. Seeing how different people explained the same concept was extremely helpful in getting things to “click”.


It is uncanny how close to my own experience the process you just described is.


Personally, I found LYAH to be a great book. If there are places where the book is incorrect, I didn't have the background knowledge to notice. I felt the book did a good job explaining applicatives and monads by starting at the very basics and very slowly ramping up the complexity to a complete understanding. I know with many math books I have had a problem where some transformation morphs equation A into equation B and the reader is left wondering how exactly B was obtained. I never felt that way reading LYAH. I could see where somebody already knowledgeable with Haskell would find the micro steps overkill, but it went at the pacing I needed.


Have you read Hutton's book?


> Terrible book.

While LYAH may not be ideal, isn't calling it "terrible" a tad too harsh?

FWIW I learned Haskell using LYAH and enjoyed it thoroughly. It was my first time learning a language with such a high focus on functional programming, but I think this book did a good job of teaching it.


Agreed. Personally I hate these kinds of books. This style, long-winded "cheery" explanations, constantly "playful", as if I was a small child that couldn't hold my attention for 2 minutes before you had to dangle a colourful toy in front of me. Like they're afraid to be serious for a moment (so many exclamation marks). I'm not here for humour, or to have a pleasant conversation. I'm here to learn. Just give me clear and concise, with minimal fluff.

If anyone is familiar with it, Landau and Lifschitz is my kind of book ;)

EDIT: I've just skimmed the Hutton book. It looks great! That's what I mean. You don't have to be dense or incomprehensible or dry. Just stick to the point and explain as clear and concise as possible.


> Like they're afraid to be serious for a moment (so many exclamation marks).

I rarely speak with enthusiasm... but teaching or explaining programming to people just gets me really, really excited. Putting myself in the shoes of a novice who is about to have some realization about the nature of an algorithm makes me shiver with anticipatory glee.

It's hard not to put that into my writing. It's not fake in the slightest—it's the only time I can let it shine through just how much I love this stuff, and it'd be fake to hide it. Even the constant "cute analogies" are part-and-parcel of this exuberance—symptoms of temporary hypomania brought about during the writing process.

Certainly, I could go back and edit all this stuff away. But, really, should I? I never had a role-model who was as excited about programming as I am. I wish I had had one. I, therefore, find it hard to restrain myself from being that person for others.


Can be cheery, playful and concise - The Little Schemer was a pleasure to read cover to cover.


I can vouch for that! It's more the endless faffing about and the distracting interruptions that irk me. In TLS the whimsy never got in the way of the learning.


I suspect few physics students would agree with you about the didactic value of LL. The audiences for the two types of books couldn't be more different.


They're definitely not the books you want for your primary learning source, but as a 2nd source pretty good for sure as long as you're comfortable filling in computation details between equations.


I learned Mechanics and Fluid Dynamics from Landau ;) It's a challenge to be sure. And it's dense. But actually the fact they tell you the ideas but not necessarily every detail sorta forces you to work things out in paper as you read, which I found very fruitful.


"LYAH is full of incorrect definitions and broken analogies."

Well it's fine for beginners, because beginners want easy explanations and many examples to start with, instead of very precise definitions which requires a precise math vocabulary.


Graham has simple and precise definitions. They're not mutually exclusive properties. No mathematical background or vocabulary is required to read Grahams book. The book is used in introductory computer science courses for undergraduate freshman.


i have never heard of haskell being a language used for teaching introductory computer science courses. that sounds like a nightmare. i'd imagine mid-to-upper div classes.


Actually Haskell is excellent for an introduction. The problem with Haskell is that it may be hard hard to get "real stuff done" so to say, i.e. in an industry setting where you have to interact with many external services or libraries (and then miss those specific libraries).

If you're learning the basics of Computer Science you usually don't have to do this so Haskell is a great language then.


Haskell was the first programming language taught at our college when I was a student, where some of the students hadn't even used a computer before. It went fine. (I think it was actually better than other languages would have been, as many of the students had a background in mathematics and might have been confused by things like "x = x + 1", while they were comfortable with the idea of a function, at least as used in mathematics.)

If you'd like to see for yourself what that course was like, here are lecture notes (and assignments, and mid-term exam): https://www.cmi.ac.in/~madhavan/courses/programming08/index....


Right. Long ago a group of Oxford physicists with no computing experience were baffled by "LET X=X+1", which the demonstrator failed to explain in terms of a storage model.

Orwell (Haskell predecessor) was used later at Oxford, and I think ML at the other university. "Preparing to study Computer Science at Cambridge" once said "Teaching yourself to program can lead to your picking up bad habits that will hinder your progress later. In particular, you should avoid languages like C++."


In the mid 90s, first year computer science at the Australian National University used Miranda, the proprietary language from which Haskell was forking at the time. It was great. When I read SICP later, the first half seemed like a long-winded demonstration of obvious ways to use recursion. Didn't everyone know this stuff?

Much of the language seemed like magic, but ANU had a culture of throwing students in the deep end to keep us humble about what we knew.


Haskell is a great language to learn as an introductory language with the right teacher and text. Read Hutton's book and come back here and tell me you found it to be too difficult for a beginner.


UChicago's honors introductory sequence uses it: http://cmsc-16100.cs.uchicago.edu/


Yes and there is a newer 2016 version (2007 one came up for me first) https://www.amazon.com/Programming-Haskell-Graham-Hutton-ebo...

(no referral link)


Thanks just bought it.


I got LYAH in a Humble Bundle and didn't make it very far before getting bored and dropping it.

I've used Rust, SML, and a bit of Scala so I don't feel like it should be that difficult to pick up Haskell. Next time I get the urge, I'll try Hutton's book.


It probably won't be for you. I was picking up Rust in 2015 and my prior Haskell knowledge (just past beginner at the time), helped immensely. There's a good deal of crossover for the broad concepts.


Yeah SML helped a lot while learning Rust for the same reason.


May be this book isn't ideal, but it explain the most important and complicated things in haskell such as Functors, Monads, Applicatives, etc.


As unfortunate as that may be, I'm glad to hear that maybe it's not that I can't learn Haskell, maybe it's just that I chose the wrong book. So here's to trying again with Hutton's book!


HaskellBook is also highly recommended


Seconding this opinion. Haven't read Graham Hutton's book, but LYAH was just really poorly structured IMO.

Some chapters are really basic and easy to read (like the chapter on recursion), and others are insanely dense and thick and basically unintelligible the first time through (like the chapter on functors).

We tried reading it for a book club once, and the weeks with the easy chapters there was no discussion to be had and the weeks with the difficult chapters ended up being "did anyone understand any of this?" and trying to figure it out together - which was somewhat helpful, but the book just really ended up being an excuse for us to learn together and not a resource in and of itself.


I have to echo this sentiment because LYAH came across as foreign and generally unhelpful. It seems that in educators' pursuits to make CS more accessible to a wider audience, this becomes one example of how not to do it.


Yeah, it tries to be funny but it's just annoying and disorganized.


I felt the same about “Why’s poignant guide”


I used this book to get introduced to Haskell and think it worked great, it’s also used as the course material in the first programming course for the CS-Program at Chalmers University of Technology (CTH) and have worked as a introduction to programming for hundreds of students every year.


Hutton's book followed by something like https://intermediatehaskell.com/ should do the trick.


Agreed, Hutton's book is really cool. I found LYAH just boring.


I must be out of the loop or this is the first I've seen this (free!) book so widely criticized. I thought it was pretty good for getting me interested in the language.

Then again, Hutton's book seems legitimately criticized too for beginners looking at the reviews I'm seeing on Amazon with some preferring or suggesting LYAH as a needed complement. So to each their own.


Thanks, will give it a shot. I got stuck with the implementation of State monads while reading LYAH probably due to the older code samples (State vs StateT). The explainations were however quite easy to grasp and I believe I assimilated some good general coding practices while reading through.


I loved it!


Terrible opinion.


+1. I want a book that walks me through a real, well designed, functional (if you pardon the pun), useful piece of software, end to end. All these FP books are too enamored with language features, instead of showing you how a programmer proficient in the language would solve practical problems in it.


The Haskell Book was better for me at least.




Applications are open for YC Summer 2019

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

Search: