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
AI エージェントと考え直すデータ基盤
na0
11
3.2k
開発生産性を組織全体の「生産性」へ! 部門間連携の壁を越える実践的ステップ
sudo5in5k
3
7.4k
Enhancing SaaS Product Reliability and Release Velocity through Optimized Testing Approach
ropqa
1
240
SmartNewsにおける 1000+ノード規模 K8s基盤 でのコスト最適化 – Spot・Gravitonの大規模導入への挑戦
vsanna2
0
140
FOSS4G 2025 KANSAI QGISで点群データをいろいろしてみた
kou_kita
0
400
AI時代の開発生産性を加速させるアーキテクチャ設計
plaidtech
PRO
3
160
VS CodeとGitHub Copilotで爆速開発!アップデートの波に乗るおさらい会 / Rapid Development with VS Code and GitHub Copilot: Catch the Latest Wave
yamachu
2
150
「クラウドコスト絶対削減」を支える技術—FinOpsを超えた徹底的なクラウドコスト削減の実践論
delta_tech
4
170
Contributing to Rails? Start with the Gems You Already Use
yahonda
2
100
freeeのアクセシビリティの現在地 / freee's Current Position on Accessibility
ymrl
2
230
20250705 Headlamp: 專注可擴展性的 Kubernetes 用戶界面
pichuang
0
280
Getting to Know Your Legacy (System) with AI-Driven Software Archeology (WeAreDevelopers World Congress 2025)
feststelltaste
1
160
Featured
See All Featured
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
229
22k
Building Adaptive Systems
keathley
43
2.7k
Intergalactic Javascript Robots from Outer Space
tanoku
271
27k
Building Flexible Design Systems
yeseniaperezcruz
328
39k
Gamification - CAS2011
davidbonilla
81
5.4k
BBQ
matthewcrist
89
9.7k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.8k
Speed Design
sergeychernyshev
32
1k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
357
30k
A Tale of Four Properties
chriscoyier
160
23k
4 Signs Your Business is Dying
shpigford
184
22k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
44
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