
Learn You a Haskell for Great Good - tosh
http://learnyouahaskell.com/
======
DonaldPShimoda
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.

~~~
BoiledCabbage
> 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
What would you recommend?

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

~~~
sulam
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).

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

~~~
acjohnson55
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.

------
AtticHacker
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.

~~~
dmix
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).

~~~
mc_
We 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.

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

~~~
myegorov
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.

~~~
sixstringbudha
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..

~~~
sridca
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/](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...](http://www.haskellforall.com/2017/10/advice-for-haskell-
beginners.html)

------
dogweather
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.

~~~
js8
> 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.

------
scottmsul
This 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.

------
s_dev
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.

~~~
Barrin92
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.

~~~
jmaa
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.

------
khannate
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.

~~~
gh02t
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.

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

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

------
ionforce
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.

------
Cieplak
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://docs.haskellstack.org)

\-
[https://commercialhaskell.github.io/intero/](https://commercialhaskell.github.io/intero/)

~~~
vapourismo
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

------
Swizec
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.

------
jose_zap
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.

~~~
Oreb
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.

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

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

~~~
Koshkin
Yes, the book is true to its title.

------
mbroncano
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.

------
dasil003
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.

~~~
thom
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).

------
Insanity
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)

------
lolive
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...](https://medium.com/@dogwith1eye/setting-up-haskell-in-vs-code-on-
macos-d2cc1ce9f60a) 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
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.

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

------
leshow
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.

------
allenleein
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](https://github.com/functionalflow/brains/projects/9)

More, over 20 _FREE_ FP books:
[https://github.com/allenleein/brains/tree/master/Zen-of-
Func...](https://github.com/allenleein/brains/tree/master/Zen-of-Functional-
Programming)

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

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

------
ilovecaching
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.

~~~
creichert
> 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](https://www.manning.com/books/get-programming-with-
haskell), [http://haskellbook.com/](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).

~~~
ilovecaching
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.

~~~
derefr
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.

------
PhantomBKB
The Haskell Book was better for me at least.

