13 ms·
Learn You a Haskell for Great Good
- DonaldPShimoda 8y agoI 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.
- ocfx 8y agoLYAH is praised cause its cutesy and feels accessible but I'm willing to bet the majority of people recommending LYAH either just saw it and thought it looked good or never got that far. The only book that ever made sense to me was Haskell Programming from First Principles (http://haskellbook.com/ http://haskellbook.com/). It really holds your hand through a lot of stuff and has a bunch of exercises.
- BoiledCabbage 8y ago> 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.
- neon_electro 8y agoWhat would you recommend?
- dvlsg 8y agoI'm not OP and it's not haskell, but fsharpforfunandprofit.com really clicked for me, personally.
- naraic0o 8y agothe 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 http://www.cis.upenn.edu/~cis194/spring13/lectures.html
- wmfiv 8y agoAnother entry in the not Haskell category, Functional Programming in Scala is outstanding.
- sulam 8y agoYes, 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).
- ChristianGeek 8y agoIt lost me about 2/3 in when it got to monads.
- acjohnson55 8y agoThat'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.
- sevensor 8y agoI'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.
- 3rdAccount 8y agoThis bothered me too. I use a REPL everyday, but you have to know how to write full programs too.
- fjsolwmv 8y agoWhat book on any language shows you whole programs that couldn't be seen in repl (assuming a repl exists)
- sevensor 8y agoOff 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.
- 3rdAccount 8y agoI 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.
- jSherz 8y agoAre there any similar resources with practical examples (other than the book Real World Haskell)?
- ghayes 8y agoI 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.
- tirumaraiselvan 8y agoI 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.
- deleted 8y ago[deleted]
- khannate 8y agoBased 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.
- gh02t 8y agoI 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.
- s_dev 8y agoStill 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.
- dvlsg 8y agoI 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.
- Barrin92 8y agoI 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.
- ilovecaching 8y agoTerrible 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.
- 0xCMP 8y agoYes and there is a newer 2016 version (2007 one came up for me first) https://www.amazon.com/Programming-Haskell-Graham-Hutton-ebook/dp/B01JGMEA3U/ref=pd_sim_351_2?_encoding=UTF8&pd_rd_i=B01JGMEA3U&pd_rd_r=be25fc6b-a57f-11e8-bc7c-f78a6db3930a&pd_rd_w=Jqvo1&pd_rd_wg=l35FA&pf_rd_i=desktop-dp-sims&pf_rd_m=ATVPDKIKX0DER&pf_rd_p=a180fdfb-b54e-4904-85ba-d852197d6c09&pf_rd_r=YYNB8C2D4ZYYW50FPEJV&pf_rd_s=desktop-dp-sims&pf_rd_t=40701&psc=1&refRID=YYNB8C2D4ZYYW50FPEJV https://www.amazon.com/Programming-Haskell-Graham-Hutton-ebo... (no referral link)
- mesarvagya 8y agoThanks just bought it.
- btmiller 8y agoI 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.
- dustingetz 8y agoI loved it!
- sbjs 8y agoAs 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!
- 3rdAccount 8y agoHaskellBook is also highly recommended
- ionforce 8y agoMany 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.
- oalessandr 8y agoAnother good (imho better) option is the Haskell book https://haskellbook.com/ https://haskellbook.com/
- chasedehan 8y agoVery good book! Definitely the best one out there
- integricho 8y agoIt 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.
- moomin 8y agoI wouldn’t hold your breath. Julie stopped work on it a long time ago. It’s pretty good as is though.
- TheSmoke 8y agoafaik all the chapters are written. the version you get on gumroad is final.
- leshow 8y agoThe 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.
- zxexz 8y agoI 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...)
- mbroncano 8y agoIt 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.
- leshow 8y agoWouldn'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.
- AtticHacker 8y agoLYAH 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.
- dmix 8y agoWhat 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).
- mc_ 8y agoWe use Erlang to build Kazoo (https://github.com/2600hz/kazoo https://github.com/2600hz/kazoo). In production since 2011, deployed around the world in various clusters.
- icc97 8y ago> 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.
- deleted 8y ago[deleted]
- jose_zap 8y agoI 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.
- Oreb 8y agoPeople 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.
- Cieplak 8y agoHaskell 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://docs.haskellstack.org - https://commercialhaskell.github.io/intero/ https://commercialhaskell.github.io/intero/
- rs86 8y agoI 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.
- vapourismo 8y agoI 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
- wilsonfiifi 8y agoWhat about "Get Programming with Haskell"[0] from Manning. Is it any good? [0]https://www.manning.com/books/get-programming-with-haskell
- Koshkin 8y agoYes, the book is true to its title.
- Insanity 8y agoI 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)
- scottmsul 8y agoThis is my all-time favorite Haskell resource: https://en.wikibooks.org/wiki/Haskell 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.
- nanook 8y agoWhat do people think of Real Word Haskell (http://book.realworldhaskell.org/ http://book.realworldhaskell.org/) ?
- egl2019 8y agoExcellent except that it is dated. GHC, libraries, and tooling have moved on in ten+ years. I would buy a new edition instantly.
- lrc 8y agoIt'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.
- Swizec 8y agoI 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.
- miguelrochefort 8y agoFirst programming book I've ever read. I love it. I haven't done Haskell since.
- lolive 8y agoI 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-code-on-macos-d2cc1ce9f60a 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/ https://get.haskellstack.org/ | sh After all that, you will have an editor that can run/debug some Haskell.
- lolive 8y agoI 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.
- bribri 8y agoI don't recommend Learn you a Haskell or Real World Haskell. Check out Haskell Programming from First Principles
- allenleein 8y agoHonestly, 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 https://github.com/functionalflow/brains/projects/9 More, over 20 FREE FP books: https://github.com/allenleein/brains/tree/master/Zen-of-Functional-Programming https://github.com/allenleein/brains/tree/master/Zen-of-Func...
- drngdds 8y agoI got about 2/3rds through this and I didn't like the lack of exercises or real example programs.
- PhantomBKB 8y agoThe Haskell Book was better for me at least.
- dasil003 8y agoIt 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.
- thom 8y agoYeah, 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).
- dogweather 8y agoLYAH 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.
- deleted 8y ago[deleted]
- js8 8y ago> 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.