A
Aditya Bhargava
adit.io · Personal blog · on HN since 2012
Aditya Bhargava, author of Grokking Algorithms, writes illustrated explanations of functional programming, Haskell, and concurrency.
What HN saysHN commenters call his pictorial guide to functors, applicatives, and monads the best and simplest explanation of monads they have seen.
68HN people shared it
43linked it in comments
41stories submitted
1.7Kstory points
1 year agolast shared
2012people per year2026
Most-shared posts
- 1Functors, applicatives, and monads in pictures43 people · 539 points · first shared 2013 · 125 comments on HN
- 2Locks, Actors and STM in Pictures7 people · 13 points · first shared 2013 · discussion on HN
- 3Three Useful Monads5 people · 74 points · first shared 2013 · 28 comments on HN
- 4Haskell Lenses In Pictures4 people · 184 points · first shared 2013 · 50 comments on HN
- 5The Dining Philosophers Problem With Ron Swanson4 people · 8 points · first shared 2013 · discussion on HN
- 6Making and deploying a website with Haskell4 people · 8 points · first shared 2013 · discussion on HN
- 7Grokking Algorithms Is Out3 people · 42 points · first shared 2016 · 2 comments on HN
- 8Building A Concurrent Web Scraper With Haskell3 people · 7 points · first shared 2012 · discussion on HN
- 9Linear Regression in Pictures3 people · 3 points · first shared 2016 · discussion on HN
- 10Homepage3 people · first shared 2013
- 11How I Made My Ruby Project 10x Faster2 people · 103 points · first shared 2013 · 57 comments on HN
- 12I Guess I'm Not A 501 Developer1 people · 295 points · first shared 2012 · 178 comments on HN
- 13Introduction to Calculus with Derivatives1 people · 268 points · first shared 2018 · 65 comments on HN
- 14Git Tips1 people · 119 points · first shared 2013 · 22 comments on HN
- 15The Monty Hall Problem in Pictures (2022)1 people · 3 points · first shared 2023 · discussion on HN
What HN people wrote when they linked it
b0sk · 2025-10-15
This is great imo -- https://www.adit.io/posts/2013-04-17-functors,_applicatives,_and_monad…
mrkeen · 2024-10-02
> You don't put semaphores around all data
You're talking about putting semaphores around code.
Locking data, not code, is a great way to do things. It composes and you don't run into too-many-locks, too-few-locks, forgetting-to-take-a-lock, or deadlocking problems.
https://www.adit.io/posts/2013-05-15-Locks,-Actors,-And-STM-In-Picture…
gaganyaan · 2024-06-03
This is still the best, simplest explanation of monads I've ever seen, no burritos required:
https://www.adit.io/posts/2013-04-17-functors,_applicatives,_and_monad…
egonschiele · 2023-09-18
Unfortunately my Mastodon server is down. Please email me! The address is on https://www.adit.io.
Leftium · 2023-02-06
Well, HtDP uses Racket, a flavor of Scheme/Lisp. So HtDP teaches with a functional language. But the contents seem to be about general program/algorithm design. (Like SICP, I started but never finished HtDP.)
I don't think HtDP/SICP explicitly cover topics from my short list of best introductions to practical FP. For example they don't seem to cover "monads" and "functional composition," which are a big part of practical FP programming.
"Monad" is a fancy mathematical term for a concept that allows you to write programs without worrying about exceptions/errors/IO cases until the very last moment. So you can keep your "happy" path code completely separate from the "sad" path code. Explained graphically: https://www.adit.io/posts/2013-04-17-functors,_applicatives,_and_monad…
lubesGordi · 2022-07-11
I'm not an expert, but this was the best resource I've found to break it down for me:
https://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in…
alexmingoia · 2020-03-23
Feel free to email me if you’re stuck. I’d be happy to help you out.
I highly recommend spending a little time trying to understand the basics. You might find “Functors, Applicatives, and Monads in Pictures” helpful: http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_…
Type classes, functors, and monads are assumed knowledge in most documentation, as they are foundational concepts in Haskell. Just like math, you must know addition, subtraction, multiplication when learning algebra.
mindcrash · 2018-10-11
I absolutely LOVE the book "Grokking Algorithms: An illustrated guide for programmers and other curious people" (http://adit.io/posts/2016-05-25-Grokking-Algorithms-Is-Out.html) by Aditya Bhargava.
If the name sounds familiar, it might because of some of his other work which includes great explanations about the M word (http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_… http://adit.io/posts/2013-06-10-three-useful-monads.html).
still_grokking · 2018-05-06
The best explanation for monads I have seen until now is this one:
http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_…
Enjoy! :)
salimmadjd · 2017-05-04
Elm is also my gateway drug into functional. And Pragmatic Studio was a great start.
Monads then seemed much easier to understand after Elm and reading this: http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_…
hardwaresofton · 2016-01-19
A tad bit off topic, but for your functional language I'd recommend Haskell. It's given my mind the most trouble out of any of the other functional languages I've tried (which is a good thing). I find it's syntax reasonable, and resources plentiful.
Excellent lecture series on functional programming (language used is Haskell):
https://channel9.msdn.com/Series/C9-Lectures-Erik-Meijer-Functional-Pr…
When you get to trying to understand monads, DON'T look up monad tutorials, look for functor -> applicative functor -> monad tutorials, like this one:
http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_…
louthy · 2015-02-19
If you want to start right at the concept level before jumping into code, this is a great intro to functors, applicatives, and monads.
http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_…
codygman · 2013-12-08
You wouldn't have to say "Oh, you forgot to declare a way to apply the greater than-greater-than-equal operator!", you would say "Oh, you forgot to declare a way to apply the bind operator!". Now that you know that, you can stop saying that ">>=" doesn't have a name? You are upsetting poor bind :/
Also here is a great explanation with pictures that helped me understand it:
http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_…
platz · 2013-12-05
I'll second Haskell wiki. It has some of the most detailed explanations of functional concepts I've come across.
http://www.haskell.org/haskellwiki/Fold
http://www.haskell.org/haskellwiki/Monad
http://www.haskell.org/haskellwiki/All_About_Monads
http://www.haskell.org/haskellwiki/Learn_Haskell_in_10_minutes
http://www.haskell.org/haskellwiki/Typeclassopedia
Also check out http://adit.io/ for some great tutorials with pictures
karlmageddon · 2013-08-20
The rest of his block is pretty great -- http://www.adit.io/index.html
Some of them have pretty cool original illustrations, too!
actsasbuffoon · 2015-03-25
I've been learning Haskell for the last year and a half, though I've been working with functionally inspired languages for 8 years. Haskell is wonderful, easily the most fun I've had learning a language in 20 years.
I'd advise not getting distracted by monads and other glamorous parts of the language. Monads are pretty abstract, and they won't likely make much sense until you've written enough Haskell to feel the pain-points they address.
I've learned a lot by reading blog posts from these people:
* Aditya Bhargava: http://adit.io
* Gabriel Gonzalez: http://www.haskellforall.com/
* Joseph Abrahamson: http://jspha.com/
* kqr (I don't know this person's full name. Avatar not withstanding, I'm pretty sure kqr isn't David Bowie): https://github.com/kqr/gists
* Edward Kmett: https://www.fpcomplete.com/user/edwardk
Most of all, I advise not getting discouraged. Haskell has a lot of concepts that seem intimidating. Many times I've spent days trying to figure out what the hell a contravariant functor is, only to get really discouraged. At times I've doubted my own abilities and whether learning the language was worth it. I stuck to it, and a year and a half later I'm pretty damn capable with Haskell (and I know what a contravariant functor is!) and I'm having the time of my life learning more about it.
rthnbgrredf · 2025-03-30
This reminds me of https://www.adit.io/posts/2013-04-17-functors,_applicatives,_and_monad…
I think over the recent years, there's been a rise in typed languages that support functional programming like TypeScript and Rust. It will be interesting to see if this trend continues in the context of AI assistant programming. My guess is that it will become easier for beginners, and the type systems will help to build more robust programs in cooperation with AI.
bobmichael · 2019-12-05
I found the article the author links to, which explains functors, applicatives, and monads in pictures, to be way more helpful: http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_…
ducaale · 2019-10-06
Blog post that explains Functors, Applicatives, And Monads in pictures http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_…
danellis · 2019-10-03
There are already many, many monad tutorials. If you want something visual, perhaps this one?
http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_…
mesarvagya · 2019-09-18
DonaldPShimoda · 2018-08-22
I like "Functors, Applicatives, and Monads in Pictures" [0] as a gentle introduction to the concepts. Same revelation as yours, but through a different vehicle.
[0] http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_…
whipoodle · 2017-09-08
This image (and ones like it) is so valuable: http://adit.io/imgs/functors/fmap_def.png
Every time you read about things even tangentially related to functional programming, you inevitably arrive at a slop of letters with arrows between them. Even just parsing that is rather difficult for non-initiates, let alone trying to grasp what it's actually saying after you've parsed it. Words and arrows (the normal kind of arrows, the kind that are for pointing at things) can help a lot.
actuallyalys · 2017-07-11
I'm not detaro, but I'll take a crack. It's kind of like traffic—if you're constantly stopping for other cars, it doesn't really help to have a faster car. If the UI thread is waiting for something else to happen, having an entire core dedicated to the UI just means that entire core is waiting. In the case detaro was alluding to, compiling Chrome was creating so many processes, the UI had to wait for the kernel to shut down processes before it could do what the UI needed it to do. [0]
Adit has some good posts on concurrency:
—http://adit.io/posts/2013-05-11-The-Dining-Philosophers-Problem-With-R…
—http://adit.io/posts/2013-05-15-Locks,-Actors,-And-STM-In-Pictures.htm…
[0]: https://randomascii.wordpress.com/2017/07/09/24-core-cpu-and-i-cant-mo…
edem · 2017-03-27
Try this one. Haskell in pictures:
http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_…
JoelSanchez · 2017-03-26
> I'm still looking for a basic article that describes monads well.
I really like this one: http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_…
jewbacca · 2017-03-08
> There's no straightforward way to make nested record updates. You have to write separate setter functions for every step of the way.
A pattern for this kind of thing in Haskell is Lenses/Prisms: http://adit.io/posts/2013-07-22-lenses-in-pictures.html
svieira · 2016-06-17
You mean, something like Functors, Applicatives, and Monads in Pictures[1]?
[1]: http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_…