Brent Yorgey
byorgey.wordpress.com · Personal blog · on HN since 2008
Brent Yorgey is a Haskell programmer and educator who writes about functional programming, math, and teaching.
What HN saysCommenters mostly cite his monad tutorial fallacy essay, call him an outstanding teacher, and point to his guide for the Catsters category theory videos.
84HN people shared it
49linked it in comments
42stories submitted
3.3Kstory points
4 months agolast shared
2008people per year2026
Most-shared posts
- 1Abstraction, intuition, and the “monad tutorial fallacy” (2009)44 people · 167 points · first shared 2009 · 75 comments on HN
- 2Conversations with a six-year-old on functional programming5 people · 2.7K points · first shared 2018 · 310 comments on HN
- 3What would Dijkstra do? Proving the associativity of min3 people · 96 points · first shared 2020 · 30 comments on HN
- 4Worstsort3 people · 75 points · first shared 2019 · 42 comments on HN
- 5Better Binary Search in Haskell3 people · 4 points · first shared 2023 · discussion on HN
- 6Parsing context sensitive languages with applicative3 people · first shared 2016
- 7Types versus sets in math and programming languages2 people · 110 points · first shared 2021 · 59 comments on HN
- 8How to print things2 people · 103 points · first shared 2016 · 10 comments on HN
- 9Catsters guide: Videos on category theory2 people · 2 points · first shared 2015 · discussion on HN
- 10Homepage2 people · first shared 2010
- 11Foldr is made of monoids2 people · first shared 2012
- 12New UPenn Haskell Course Materials Released on GitHub1 people · 13 points · first shared 2016 · 1 comments on HN
- 13Counting Inversions via Rank Queries1 people · 12 points · first shared 2019 · 3 comments on HN
- 14Deriving pleasure from GHC 6.12.11 people · 4 points · first shared 2010 · discussion on HN
- 15Competitive programming in Haskell: monoidal accumulation1 people · 4 points · first shared 2021 · discussion on HN
What HN people wrote when they linked it
andrewflnr · 2019-12-06
This is well understood, as witnessed by this classic article: https://byorgey.wordpress.com/2009/01/12/abstraction-intuition-and-the…
zwass · 2018-05-07
Brent is one of the greatest teachers I've ever experienced. I used to take classes from him (and TA some others he taught) and was consistently blown away by his enthusiasm and capacity for sharing concepts. He has a great essay on pedagogy as well (https://byorgey.wordpress.com/2009/01/12/abstraction-intuition-and-the…
If you're interested in learning some of the beautiful foundations of functional programming, I highly recommend checking out the lecture notes and assignments from his Penn CIS 194 class (http://www.cis.upenn.edu/~cis194/spring13/lectures.html)
jeeyoungk · 2016-04-23
My favorite on this subject is "Monads are like burritos"
https://byorgey.wordpress.com/2009/01/12/abstraction-intuition-and-the…
tel · 2015-01-04
There are the Catsters which have produced a large and wonderful set of videos teaching Category theory. This is the best guide I know to watching those videos:
https://byorgey.wordpress.com/catsters-guide-2/
Dr. Cheng's enthusiasm is incredible.
Zababa · 2021-10-18
> Calling for lack of metaphor is interesting. In many ways, our industry is nothing but metaphors, so it is surprising for me to see them called down.
I don't think that's true. There are lots of metaphor because people love using metaphors, but it's not inherent to our industry. Abstraction is, but abstraction and metaphors are different. Metaphors seem to mostly come from blog-post type content, where people want to give you an intuition for something in less than 10 minutes. There's a really good article about this, in the context of monad tutorials, which are some of the most proheminent victims of these metaphors https://byorgey.wordpress.com/2009/01/12/abstraction-intuition-and-the…
> I agree that no metaphor is perfect. But, by that same logic, I would argue that no specified type is perfect. Especially if done so in a taxonomy that does not admit exceptions. (And again, I'm not against types.)
I would call types an abstraction rather than a metaphor, though I agree with you that they are not perfect, in that all abstractions trade precision and exhaustiveness for speed. There are interesting alternatives to this with property-based checking and whatever clojure.spec is, and type systems themsleves are getting better, but we're still not at perfection. And even then, I don't think we will ever reach it. The "best" type systems currently all seem to have some structural parts, and some nominal parts, so there's no silver bullet.
I mostly…
nybble41 · 2019-04-05
> Also you need applicatives, which is just a way to box things. i.e turning a Int into a List<Int>.
Applicative functions do have that property, but their key attribute is the ability to two things together, e.g. turning a List<Int> and a List<Double> into a List<Pair<Int,Double>>. A functor which also has the ability to put arbitrary things into the functor context, but not the ability to combine two contexts, is sometimes referred to as a pointed functor. (There is no official Haskell typeclass for pointed functors; the main reason, besides historical baggage, is that non-applicative pointed functors don't have any real laws aside from the ones which apply to functors.)
Applicatives are sufficient for sequencing effects but the List<Double> in the previous example can't depend on the Int values in the List<Int>. This is great for static analysis of effects but it limits the kinds of programs you can write to those whose effects are known in advance. A monad lifts this restriction and allows effects (not just values) to be computed dynamically from the values of prior effects.
Finite[1] applicative parsers can only parse context-free languages. Monadic parsers, on the other hand, can handle context-sensitive languages (without resorting to an infinite set of production rules).
[1] https://byorgey.wordpress.com/2012/01/05/parsing-context-sensitive-lan…
zenhack · 2018-02-16
First, going straight to "How do I understand Monads?" is not a good idea. I remeber when this article showed up on the web, and I remember wishing it had been written before I started learning Haskell:
https://byorgey.wordpress.com/2009/01/12/abstraction-intuition-and-the…
If you want to understand monads, start hacking and watch for patterns.
> But, just to be super honest -- and possibly completely wrong -- the terminology is really off-putting. At a glance it just feels super complex, academic and completely divorced from practical coding. I get vibes of enterprise java class hierarchies looking at this stuff.
Yeah, and here's my take on why it looks like that:
First, the terminology is all borrowed from mathematics, hence the academic tone. People can debate on the merits of this; I think it makes more sense when you're making tools for folks who are already familiar with the usual notation, but e.g. if you're not dealing with people who are already accustomed to the way physisicts talk about things, "p" is probably not the best variable name for momentum, traditional as it may be.
The authors of that document seem to have gone even farther in that direction than the Haskell folks -- Setoid? really? It's just fing equals! even Haskell calls it Eq. At least they kept Ord.
Also, the design looks to be basically transliterated from Haskell. There's been no attempt to adapt it to either javascript's strengths or its weaknesses. For example:
…
mechanical_fish · 2014-09-06
Apple incorporated most of these patterns into Cocoa and Cocoa Touch.
Great! That means I could just learn to work with Cocoa and Cocoa Touch and skip the tedious exposition.
I would try to explain why I've never been able to pick up a patterns book without eventually throwing it against a wall, and why I prefer to encounter my patterns in the wild as I work on actual code, where I can poke and prod them and watch how they behave in practice, but it's already been throughly explained and even given a name, The Monad Tutorial Fallacy:
http://byorgey.wordpress.com/2009/01/12/abstraction-intuition-and-the-…
Sounds to me like your junior Android developers might be learning patterns just fine: They trip over one in practice, and then they learn about it with the help of their teacher. This is how learning works. There is no royal road to geometry, and beginners don't become experts overnight just by reading the right book.
crntaylor · 2013-06-02
Author of the blog post here. It's amusing to see this submitted by Don Stewart, since it was his explanation[0] of algebraic data types that first made them "click" for me! I think I forgot to mention him in this post, but I remembered in the talk[1].
If anyone's interested in this and where else it might go, I recommend read Don's SO answer[0], this SO question and the related answers[2] and these papers [3,4] on derivatives and dissections by Conor McBride. There are also several good blog posts[5] and a paper[6] by Brent Yorgey on the topic of combinatorial species, and of course Dan Piponi's blog[7] is a treasure trove of interesting insights at the intersection of math, physics and computer science.
[0] http://stackoverflow.com/a/5917133/546084
[1] http://www.youtube.com/watch?v=YScIPA8RbVE (shitty audio for the first minute or 2 - it gets better).
[2] http://stackoverflow.com/questions/9190352/abusing-the-algebra-of-alge…
[3] http://strictlypositive.org/diff.pdf
[4] https://personal.cis.strath.ac.uk/conor.mcbride/Dissect.pdf
[5] http://byorgey.wordpress.com/
[6] http://www.cis.upenn.edu/~byorgey/papers/species-pearl.pdf
[7] http://blog.sigfpe.com/2010/08/divided-differences-and-tomography-of.h…
Edit: It should go without saying, but because a few people last time around seemed to think I was trying to pass this off as my own ideas, let me state that there is nothing original in this blog post. It's a repackaging of the…
stevekrouse · 2026-07-20
https://worrydream.com
https://macwright.com/
https://www.petemillspaugh.com/
https://www.geoffreylitt.com/
https://maggieappleton.com/
https://www.robinsloan.com/
https://thesephist.com/
https://wattenberger.com/
http://conal.net/
https://www.todepond.com/
https://devonzuegel.com/
https://nadia.xyz/
https://adamwiggins.com/
http://glench.com/
https://ncase.me/
Classic from my old Haskell professor: https://byorgey.wordpress.com/2009/01/12/abstraction-intuition-and-the…
JadeNB · 2025-02-13
In theoretical CS, I've seen Steps 4–8 called "the monad tutorial fallacy."
https://byorgey.wordpress.com/2009/01/12/abstraction-intuition-and-the…
Handprint4469 · 2024-12-08
Yes, exactly. See [0] for a concrete example of an abstraction that can't be grokked without grinding concrete examples, and how people who have already grokked it forget this fact.
[0]: https://byorgey.wordpress.com/2009/01/12/abstraction-intuition-and-the…
998244353 · 2024-11-14
I'm not saying you're wrong, but I wonder if this "missing piece of insight" is at least sometimes an illusion, as in the "monads are like burritos" fallacy [0]. Of course this does not apply if there really is just a missing fact that too many explanations glossed over.
[0] https://byorgey.wordpress.com/2009/01/12/abstraction-intuition-and-the…
thesz · 2024-11-08
The question comes from Haskell, yes: https://byorgey.wordpress.com/2012/01/05/parsing-context-sensitive-lan…
You used monadic parser, monadic parsers are known to be able to parse context-sensitive grammars. But, they hide the fact that they are combiinators, implemented with closures beneath them. For example, that "count n $ char 'b'" can be as complex as parsing a set of statements containing expressions with an operator specified (symbol, fixity, precedence) earlier in code.
In Haskell, it is easy - parameterize your expression grammar with operators, apply them, parse text. This will work even with Applicative parsers, even unextended.
But in Rust? I haven't seen how it can be done.
burkaman · 2024-09-30
This is an inside joke about people who write monad tutorials and think they've completely solved the issue by explaining that they're just like, for example, burritos: https://byorgey.wordpress.com/2009/01/12/abstraction-intuition-and-the…
aidenn0 · 2024-08-15
Very off-topic, but has anyone ever read a book that someone else credited with changing their life and felt like their own life was changed?
Anecdotally I haven't despite having read at least a dozen such books. Assuming I'm not an outlier, I think it's a bit like the "monad tutorial fallacy[1]" where the book crystalizes things that have already been bouncing around in one's head, rather than being the original source of the change.
1: https://byorgey.wordpress.com/2009/01/12/abstraction-intuition-and-the…
gabesullice · 2024-06-02
I've referred to this blog post at least twice a year since I read it 6 or 7 years ago. Not because I need to explain monads, but because the "monad tutorial fallacy" [1] is an incredibly useful concept to be aware of when trying to convey knowledge. I encourage you to read about it :)
[1] https://byorgey.wordpress.com/2009/01/12/abstraction-intuition-and-the…
Al0neStar · 2023-06-16
Did Einstein, Neumann or Feynam surpass their professors? If the measure is scientific progress then yes but if the measure is professing then NO.
When you finish reading "The Feynam Lectures" you feel unstoppable but then you open a problem book and youre stomped because youve just picked up someone elses mental model.
A good professor holds your hand just enough for you to build your own mental model and doesnt just regurgitate his own model. [0]
[0] https://byorgey.wordpress.com/2009/01/12/abstraction-intuition-and-the…
Rayhem · 2023-01-15
This is very much called out in the Monad Burrito Tutorial Fallacy[1].
[1]: https://byorgey.wordpress.com/2009/01/12/abstraction-intuition-and-the…
hprotagonist · 2023-01-15
https://byorgey.wordpress.com/2009/01/12/abstraction-intuition-and-the…
well, it’s so simple: they’re just burritos!
bspammer · 2022-11-17
You cannot really understand monads just by reading about them. Or I couldn’t, at least.
This is a very good article about the problems with monad tutorials: https://byorgey.wordpress.com/2009/01/12/abstraction-intuition-and-the…
> “Of course!” Joe thinks. “It’s all so simple now. The key to understanding monads is that they are Like Burritos. If only I had thought of this before!” The problem, of course, is that if Joe HAD thought of this before, it wouldn’t have helped: the week of struggling through details was a necessary and integral part of forming Joe’s Burrito intuition, not a sad consequence of his failure to hit upon the idea sooner.
TL;DR There’s no beautiful explanation that will help you understand, you need to get your hands dirty with code.
tromp · 2021-09-06
You could check out all the references at the bottom of the README. The ranking implementation was heavily inspired by Brent Yorgey's Data.Enumeration.Invertible [1] that he blogged about at [2].
[1] https://hackage.haskell.org/package/simple-enumeration-0.2/docs/Data-E…
[2] https://byorgey.wordpress.com/2019/07/05/lightweight-invertible-enumer…
the_benno · 2021-05-06
Except that is explicitly a parody/critique of what Brent Yorgey called the "monad tutorial fallacy": https://byorgey.wordpress.com/2009/01/12/abstraction-intuition-and-the…
This is the post that originally coined that phrase.
edub · 2021-03-03
the main difference is that you can't have pages 4 and 5 side by side with the proposed method, since they are back to back on the same sheet.
edit: thih9 linked to the hn post on byorgey original blog post in 2016 and the highest comment by audeyisaacs suggests the same thing you did and got a reply from byorgey who liked the idea and added it to their blog, and outlined the pro's and con's of your suggestion.
https://byorgey.wordpress.com/how-to-print-things/
tylerhou · 2019-12-05
Except this “simple” metaphor isn’t too useful. For monads like IO and State, “monad as a container” is a stretch. And some don’t fit at all — the list monad often is imagined as a computational context with nondeterminism, not simply a container.
https://byorgey.wordpress.com/2009/01/12/abstraction-intuition-and-the…
the_af · 2019-12-05
The problem is, of course, that a monad is not a value in a box. That's a misunderstanding, resulting from an oversimplified metaphor. This shows a frequent problem with metaphors.
See "the fallacy of monad tutorials": https://byorgey.wordpress.com/2009/01/12/abstraction-intuition-and-the…
aantix · 2019-11-26
The "Function Machine Game"?
https://byorgey.wordpress.com/2018/05/06/conversations-with-a-six-year…
“Hey, I have a good idea for a game,” I said. “It’s called the function machine game. I will think of a function machine. You tell me things to put into the function machine, and I will tell you what comes out. Then you have to guess what the function machine does.”
kark · 2019-06-24
See the “monad tutorial fallacy”: https://byorgey.wordpress.com/2009/01/12/abstraction-intuition-and-the…
yogsototh · 2019-03-19
mlevental · 2018-11-05
i don't know why you're getting downvoted because spelling out the pragmatics of monads using Maybe is exactly the right way to teach people about monads and gp is committing monad fallacy (though doing a nice job regardless of explaining to people like myself who already know a little)
https://byorgey.wordpress.com/2009/01/12/abstraction-intuition-and-the…