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
410
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
150
Progressive Web Apps In Clojure(Script)
gja
4
2.5k
Monads you've already put in production (without knowing it)
gja
1
1.2k
Native Extensions Served 3 Ways
gja
0
380
Other Decks in Technology
See All in Technology
LiDARが変えたARの"距離感"
zozotech
PRO
0
260
Three-Legged OAuth in AgentCore Gateway
hironobuiga
1
110
OWASP Top 10:2025 リリースと 少しの日本語化にまつわる裏話
okdt
PRO
3
1.1k
新規事業開発でのAWS活用
amixedcolor
1
180
生成AIで始める業務改革 - 製造業編 in 福島 -
daikikanemitsu
2
580
生成AIと余白 〜開発スピードが向上した今、何に向き合う?〜
kakehashi
PRO
1
250
Cloud Runでコロプラが挑む 生成AI×ゲーム『神魔狩りのツクヨミ』の裏側
colopl
0
430
SchooでVue.js/Nuxtを技術選定している理由
yamanoku
3
7.9k
AWS DevOps Agent x ECS on Fargate検証 / AWS DevOps Agent x ECS on Fargate
kinunori
3
420
Open Table Formatにおけるストレージ抽象化の比較
lycorptech_jp
PRO
1
180
Azure Copilot Migration Agent / #jazug
koudaiii
1
210
AIエージェントに必要なのはデータではなく文脈だった/ai-agent-context-graph-mybest
jonnojun
1
650
Featured
See All Featured
The Power of CSS Pseudo Elements
geoffreycrofte
80
6.2k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.2k
The Cult of Friendly URLs
andyhume
79
6.8k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
230
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
270
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1k
Practical Orchestrator
shlominoach
191
11k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
800
How GitHub (no longer) Works
holman
316
140k
Deep Space Network (abreviated)
tonyrice
0
73
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
150
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