Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Lightning - Monads you already use (without kno...
Search
Tejas Dinkar
July 19, 2014
Technology
1
390
Lightning - Monads you already use (without knowing it)
The lightning talk version of this talk.
Tejas Dinkar
July 19, 2014
Tweet
Share
More Decks by Tejas Dinkar
See All by Tejas Dinkar
Quick Wins for Page Speed
gja
0
120
Progressive Web Apps In Clojure(Script)
gja
4
2.4k
Monads you've already put in production (without knowing it)
gja
1
1.1k
Native Extensions Served 3 Ways
gja
0
350
Other Decks in Technology
See All in Technology
MapStore at geOcom 2025: A Year in Review
simboss
PRO
0
100
AWS Organizations 新機能!マルチパーティ承認の紹介
yhana
1
180
生成AI活用の組織格差を解消する 〜ビジネス職のCursor導入が開発効率に与えた好循環〜 / Closing the Organizational Gap in AI Adoption
upamune
5
4.2k
MySQL5.6から8.4へ 戦いの記録
kyoshidaxx
1
270
急成長を支える基盤作り〜地道な改善からコツコツと〜 #cre_meetup
stefafafan
0
140
自律的なスケーリング手法FASTにおけるVPoEとしてのアカウンタビリティ / dev-productivity-con-2025
yoshikiiida
0
110
Should Our Project Join the CNCF? (Japanese Recap)
whywaita
PRO
0
250
Yamla: Rustでつくるリアルタイム性を追求した機械学習基盤 / Yamla: A Rust-Based Machine Learning Platform Pursuing Real-Time Capabilities
lycorptech_jp
PRO
4
150
Understanding_Thread_Tuning_for_Inference_Servers_of_Deep_Models.pdf
lycorptech_jp
PRO
0
140
Geminiとv0による高速プロトタイピング
shinya337
0
130
【5分でわかる】セーフィー エンジニア向け会社紹介
safie_recruit
0
26k
なぜ私はいま、ここにいるのか? #もがく中堅デザイナー #プロダクトデザイナー
bengo4com
0
1.1k
Featured
See All Featured
Measuring & Analyzing Core Web Vitals
bluesmoon
7
490
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
252
21k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3.3k
Stop Working from a Prison Cell
hatefulcrawdad
270
20k
Embracing the Ebb and Flow
colly
86
4.7k
Building a Scalable Design System with Sketch
lauravandoore
462
33k
Typedesign – Prime Four
hannesfritz
42
2.7k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
What's in a price? How to price your products and services
michaelherold
246
12k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
2.9k
Agile that works and the tools we love
rasmusluckow
329
21k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
35
2.4k
Transcript
Monads you’ve already put in prod Tejas Dinkar Nilenso Software
about.me • Hi, I’m Tejas • Nilenso: Partner • twitter:
tdinkar • github: gja
If you think you understand Monads, you don't understand Monads.
This talk is inaccurate and will make a mathematician cry
Monads • Programmable Semicolons • Used to hide plumbing away
from you • Monads are just monoids in the category of endofunctors
None
Values Value
Monads Value Box
Monads • Monads define two functions • return takes a
value and puts it in a box • bind takes a box & function, and returns a box with f(value)
Some math (√4) + 5
Some math (√4) + 5 3 or 7!
Value 4
Monad [4]
return def m_return(x) [x] end # m_r(4) => [4]
Square Root fn def sqrt(x) s = Math.sqrt(x) [s, -s]
end # sqrt(4) => [2, -2]
Bind Function x = m_return(4) y = ?????(x) { |p|
sqrt(p) } # I want [-2, 2]
Bind Function x = m_return(4) y = x.flat_map {|p| sqrt(p)
} # y => [2, -2]
Increment Fn def inc_5(x) [x + 5] end # inc_5(1)
=> [6]
Putting it together m_return(4). flat_map {|p| sqrt(p)}. flat_map {|p| inc_5(p)}
# => [3, 7]
You have invented the List Monad, used to model non-determinism
Congrats