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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Tejas Dinkar
July 19, 2014
Technology
420
1
Share
Lightning - Monads you already use (without knowing it)
The lightning talk version of this talk.
Tejas Dinkar
July 19, 2014
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
390
Other Decks in Technology
See All in Technology
知ってた?JavaScriptの"正しさ"を検証するテストが5万以上もあること(Test262)
riyaamemiya
1
190
小さいVue.jsを30分で作る
hal_spidernight
0
150
How to learn AWS Well-Architected with AWS BuilderCards: Security Edition
coosuke
PRO
0
120
2026年春のAgentCoreアプデ 細かいやつ全部まとめ
minorun365
3
220
Claude Code / Codex / Kiro に AWS 権限を 渡すとき、何を設計すべきか
k_adachi_01
4
1.1k
Purview 勉強会報告 Microsoft Purview 入門しようとしてみた
masakichixo
1
360
AI対話分析の夢と、汚いデータの現実 Looker / Dataplex / Dataform で実現する品質ファーストな基盤設計
waiwai2111
0
420
ワールドカフェ再び、そしてゴール・ルール・ロール・ツール / World Café Revisited, and the Goals-Rules-Roles-Tools
ks91
PRO
0
130
QAエンジニアはどうやって プロダクト議論の場に入れるのか?
moritamasami
2
420
拝啓、あの夏の僕へ〜あなたも知っているApp Runnerの世界〜
news_it_enj
0
240
Oracle AI Database@AWS:サービス概要のご紹介
oracle4engineer
PRO
4
2.5k
毎日の作業を Claude Code 経由にしたら、 ノウハウがコードになった
kossykinto
1
1.3k
Featured
See All Featured
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
65
54k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
350
Skip the Path - Find Your Career Trail
mkilby
1
120
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.8k
Facilitating Awesome Meetings
lara
57
6.8k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
140
Unsuck your backbone
ammeep
672
58k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
130
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
65
55k
Context Engineering - Making Every Token Count
addyosmani
9
870
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
360
The Pragmatic Product Professional
lauravandoore
37
7.3k
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