Monads in JavaScript: I Promise you’ll have a good time by Max Nordlund
Вставка
- Опубліковано 28 чер 2024
- Monads are a powerful abstraction, yet can be daunting to get into at first. In this presentation I'll introduce the concept of monads through JavaScripts Promises. I’ll also show how you can find monads in other, unexpected, places and how the ever popular `do`-notation works under the hood.
Max Nordlund
I work at Kivra, where the main language is Erlang, and main database is Riak. But before that I’ve worked professionally with JavaScripts for quite a few years. I introduces Promises at my first gig 2013, and haven’t looked back since. They are a lovely abstraction, and later I found out that they are in fact monads. Outside programming I’m a scout leader for youngsters 15-18. Working with kids, and young adults, really teaches you new perspective and to not take things for granted.
/ maxnordlund
/ nevonnen
If you want to get featured on the channel and have something to present, please head over to MeetUp and contact the organizers: www.meetup.com/Func-Prog-Sweden
Video sponsor - Ada Beat
adabeat.com/
If you want to spread functional programming and support the channel, buy something from the shop: funcprogsweden.myspreadshop.net/
The chapters:
00:00 Welcome by Magnus Sedlacek
00:33 Intro by Max Nordlund
01:15 The monadic curse
02:17 The plan
02:56 What is a monad?
08:08 What about JavaScript?
10:46 What about Monads in JavaScript?
15:00 Live coding setup hazel
16:42 Live coding flatmap
21:12 Live coding promise (async/await and then)
34:20 Monads in Go
39:08 Law of the instruments
40:35 Questions
#funcprogsweden - Наука та технологія
Nice presentation! I'm very well versed with Promises and async await and I know well when to use them, but even after watching this I'm still not sure what monads are. So I don't think the monadic curse was broken here unfortunately. I'll go read some more 😅
After watching the video, it finally dawns on me why people are so confused about monad. It's because the people explaining it don't know what a monad is or has a very vague idea what it is or is unable to articulate what a monad is.
Max is max!!! Thank's for inspiring presentation!
13:00 You made a mistake, you map over an array with the map function, not flatMap.
If you listen to what he is actually saying you’ll realize he’s completely correct.
Fun video but as educational content, it's not really watchable.