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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
システム思考で問題に対処する
yussak
0
300
【CEDEC2026】コードレビュー支援ツール開発から学ぶ:LLMを用いた業務システムの実践的な運用設計と誤出力対策
cygames
PRO
0
810
グローバル基準のSREは、運用現場でどう機能したか:成熟度アセスメントの実践 / SRE NEXT 2026
sorawatanabe
0
260
ソフトウェアサプライチェーンの構造的リスクとコンテナ環境の保護
kyohmizu
3
240
MulticaとPi Coding Agentで、小規模OSSを30本同時運用した流れ
eiei114
0
130
猫付きpingコマンドを自作
uyuki234
0
240
My broken English still works: speaking at global OSS events
naruoga
0
100
会社紹介資料 / Sansan Company Profile
sansan33
PRO
24
430k
Bill One 開発エンジニア 紹介資料
sansan33
PRO
7
19k
Bits Agent Builder の⼊⾨と活⽤事例
nulabinc
PRO
0
160
攻撃と防御で学ぶAI時代のプロダクトセキュリティ演習
recruitengineers
PRO
9
2.9k
LanceDB入門
mocobeta
8
550
Featured
See All Featured
Making the Leap to Tech Lead
cromwellryan
135
10k
Code Review Best Practice
trishagee
74
20k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Leo the Paperboy
mayatellez
8
2.1k
AI: The stuff that nobody shows you
jnunemaker
PRO
9
910
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
410
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
430
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.8k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
250
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.4k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.8k
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