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
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Tejas Dinkar
July 19, 2014
Technology
430
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
160
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
Flutterをカメラで動かしたかった話
sony
1
140
TypeScript入門 2026
recruitengineers
PRO
3
600
認知負荷をGemini で溶かす — GKE 基盤「Orbit」における AI エージェントの実践
sansantech
PRO
1
310
Digitization部 紹介資料
sansan33
PRO
2
7.7k
【CEDEC2026】次世代デジタルカードゲームのサーバー設計と運用 〜『Shadowverse: Worlds Beyond』の舞台裏~
cygames
PRO
1
1.3k
2026-08-05 IBM Z開発最前線!IBM Bob Premium Package for Zって何がすごいの?
yutanonaka
0
130
制約理論(ToC)入門 2026版
recruitengineers
PRO
8
2.3k
強化学習「理論」入門
enakai00
3
3.6k
まちスペース®とデジタルツインと「まちづくり」
hiro_ogi
0
120
【AG-UI × A2UI × MCP Apps】Generative UIをやさしく解説する
nrinetcom
PRO
1
130
つくって納得、つかって実感! 大規模言語モデルことはじめ ver2.0
recruitengineers
PRO
4
1.7k
え?フロントエンドエンジニアの ワイがインフラも!?
puku0x
1
620
Featured
See All Featured
KATA
mclloyd
PRO
35
15k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
200
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
420
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.9k
Chasing Engaging Ingredients in Design
codingconduct
0
270
How STYLIGHT went responsive
nonsquared
100
6.2k
How to Ace a Technical Interview
jacobian
281
24k
Thoughts on Productivity
jonyablonski
76
5.3k
Exploring anti-patterns in Rails
aemeredith
3
460
Testing 201, or: Great Expectations
jmmastey
46
8.2k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
530
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.5k
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