Brian Beckman: Don't fear the Monad
jasonofthel33t9 HN recommenders · recommended in 10 months, 2012–2024
lecture · intro · evergreen · 2012–2024 on HN
Microsoft's Brian Beckman gives an hour-long, whiteboard-style walk through monads, building from function composition and monoids using school-level math. It is aimed at practicing programmers rather than category theorists.
HN repeatedly recommends it as the clearest and most correct beginner explanation of monads, with several commenters saying it finally made them click.
Up next
2 mo on HNDmitry Vyukov — Go scheduler: Implementing language with lightweight concurrency
Hydra
2 HN recommender · 2020–2026
16 mo on HNHow to Speak
MIT OpenCourseWare
17 HN recommender · 2020–2025
3 mo on HNGoogle Developers Day US - Python Design Patterns
GoogleDeveloperDay
2 HN recommender · 2011–2020
6 mo on HNOld pinball machines are amazingly complex
Technology Connections
6 HN recommender · 2023–2026
4 mo on HNEdwin Brady - Idris 2 - Type-driven Development of Idris
Curry On!
4 HN recommender · 2019–2023
5 mo on HNAlan Kay at OOPSLA 1997 - The computer revolution hasnt happened yet
Jeff Gonis
6 HN recommender · 2013–2025
5 mo on HNClassic Game Postmortem: Ultima Online
GDC Festival of Gaming
5 HN recommender · 2018–2024
18 mo on HNVectors | Chapter 1, Essence of linear algebra
3Blue1Brown
17 HN recommender · 2018–2026
18 mo on HNRuby Conf 12 - Y Not- Adventures in Functional Programming by Jim Weirich
Confreaks
17 HN recommender · 2013–2026
14 mo on HNThe Soul of Erlang and Elixir • Sasa Juric • GOTO 2019
GOTO Conferences
16 HN recommender · 2019–2024
14 mo on HN"Simple Made Easy" - Rich Hickey (2011)
Strange Loop Conference
14 HN recommender · 2022–2026
13 mo on HN"Making Impossible States Impossible" by Richard Feldman
elm-conf
9 HN recommender · 2017–2026
12 comments from Hacker News
I don't know category theory, so I defer to more knowledgeable people here, but that sounds strange: "Functor it understands how to take doStuff and execute it on the value inside itself, then spit out a new Optional. You don't lose the int-ness or optional-ness." So if I map a function, that takes an int and returns a string over an array of ints, this array stops being a functor? Or is it just a Swift thing? And, as always, I urge people spend an hour of their life and get the explanation of all this from someone who knows the math but still able to explain this in plain English: ▶ this video To the best of my limited knowledge, it's all 100% correct.
To be fair, (I think) you don't need to know category theory to successfully apply FP principles and/or use any functional language. I had a great (GREAT) success at using erlang not only not knowing what monad is, but even not knowing about existence of category theory at all, leave aside monads, monoids, functors, etc. You also don't need to know category theory to understand what monad is [0] This video is all you, as a practicing programmer, need to know about monads and it's just 1 hour long. [0] ▶ this video
Good tutorial I think and I also appreciated reading the beginning of link and watching "Don't fear the Monad" ▶ this video
▶ this video I found Brian Beckman's video Don't Fear the Monad was extremely helpful for understanding monads as a practical user. I now use them everywhere. I don't know the first thing about category theory.
Thats me here too! >.< Yeah the hidden subtext here was my presumption in that suggestion was someone was learning monads in Haskell and has at least a basic understanding of Haskell. Sorry if those papers threw you into the deep end. Monads really were thrown into play due to trying to make a pure functional programming language useful. I found the more mathematical explanation a lot easier than any analogies involving say burritos or pipes etc... At first glance to imperative programmers I will admit all of this just looks like a bunch of navel gazing. I thought the same thing, but once you let go of thinking of computation as a series of steps and at a bit of a higher abstraction this makes a lot more sense. For a more soft introduction to the concepts this channel 9 video is probably a bit better: ▶ this video Another option might be to just get the haskell programming from first principles book: link Does a good job grounding you up to monads and gives copious amounts of reference material. Even though I already knew haskell when I read the book it helped clear up some gaps I didn't know I had. But monads are going to be really weird no matter if all you've ever seen is imperative programming. Despite the fact that you already use them and have probably discovered them without knowing you did. Much like learning stack based programming languages, sometimes the only way up is to climb off the computational hill you're familiar with to learn another way to the other hill side
In a Group, every element has an inverse element. If you drop this property, you get a Monoid.[0] Functions under function composition form a Monoid (or Monoidal Category). Brian Beckman did a nice intro video to this at MS Channel 9 a few years back.[1] [0] link [1] "Brian Beckman: Don't fear the Monad" ▶ this video
I'd suggest a longer (1 hour) but much more correct explanation. It doesn't use math beyond high (or even may be middle) school. Video, unfortunately. ▶ this video
I've seen the same video before i knew what a monad was, it helped me in understanding the use case of monad and ultimately monad. Monad is just a generalization of that particular use case. Some resources that helped me in understanding monads 1. Brian Beckman: Don't fear the Monad - ▶ this video 2. Functors, Applicatives, And Monads In Pictures - link 3. Three Useful Monads - link So its been not just one resource but multiple resource before it hit me that it was such a simple concept. So i would suggest to go over them (in order) and also look at other resources (mentioned by others).
This whole video is worth watching, but a simple monoid overview is here: ▶ this video It's not a difficult concept.
> and apparently I'm never going to understand Haskell I found this introduction to the concepts of functional programming (functional composition) to be useful: ▶ this video Otherwise, it's just a different way of thinking about problems. Instead of building things structurally as an object of objects, and then creating functions that relate, transform, or describe the relationships between the object structures (like taking a pixel object, altering it's x coordinate, and returning the new pixel object with only the x coordinate altered), one has functions that can be composed with other functions to produce more complex object structures. A single base unit with a sequence of functional compositions can describe a very fancy, complex unit, with many fancy, complex characteristics. >> Monads have also been explained with a physical metaphor as assembly lines, where a conveyor belt transports data between functional units that transform it one step at a time.[2] They can also be seen as a functional design pattern to build generic types.[3] link Otherwise, it's syntax and semantics, which I generally find annoying, but there's always google and books. link
Apples and oranges. A monad is just an idea; that of storing computations as values. This is useful because these computations can be composed together in a manner not unlike that of a pipeline in shell scripting. Different monads define different ways of composing these computations leading to vastly different semantics. Here's a nice video that explains monads fairly simply: ▶ this video
Right, I understand where I wasn't clear. You're right, that idea has won and gone mainstream so I didn't think it was worth mentioning. I was emphasizing that I thought immutable data structures were inefficient and that it was the luxury of academics to abstract away stateful changes in the name of purity. I've got a couple of other ideas that I need to do more research on (I'm watching Erik Meijer videos today) 1) Class objects with methods and data are like small programs, so I don't get why people go on and on about having data structures with functions as being superior to class objects, which are essentially data structures with associated functions. 2) Similarly, Joe Armstrong seems to hate object oriented programming but Erlang instances are essentially class objects, albeit running in their own process so they have more isolation 3) From reading Erik Meijer's Confessions of a Used Programming Language Salesman, I'm assuming that Async/Await that he help put in C# and Dart are his attempt to bring Haskell continuation monads to the imperative world 4) I'm assuming Clojure Atoms and Actors are like Haskell monads but don't know that. I watched Brian Beckman: Don't fear the Monad ( ▶ this video ) but couldn't make heads or tails of it. Something about functions calling first order functions and pure first order effects with stateful second order effects, or something... That was a few years ago so I will give it another chance. I'm probably wrong about these ideas but they'