Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
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
440
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.3k
Native Extensions Served 3 Ways
gja
0
390
Other Decks in Technology
See All in Technology
Conditional PED-ANOVA: Hyperparameter Importance in Hierarchical & Dynamic Search Spaces
pfn
PRO
0
140
Kiro Crewで「みのるん式」仕事術やってみた
minorun365
PRO
3
930
AI × アーキテクト 第1・2章|生成AIの課題とアーキテクトの素養
daidaidai
0
190
Local CI × GitHub Actions
gogutan
3
230
事業成長とデータ活用を止めないためのマネジメントへ挑戦
hiracky16
0
410
Browser Spec: Testing Hotwire with Ruby
takahashim
1
140
PHPカンファレンス関西の招待状 / Invitation to PHP Conference Kansai
ykanoh
0
220
Post AI時代のリファクタリング実践記 / Refactoring in the post AI era
kaminashi
1
310
PagerDuty Tech Hub-鳴らすけれど、人は動かない
ezaki
0
190
「私が一番顧客に詳しい」を捨てる~ 全員が一次情報に精通する開発チームをつくり、PMが次のボトルネックへ染み出すまで
kaminashi
0
130
Active Record Connection Adaptersにおける長年の課題に再び取り組む
yahonda
0
350
Refining Active Record
shugo
0
180
Featured
See All Featured
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.5k
Darren the Foodie - Storyboard
khoart
PRO
4
4k
Paper Plane (Part 1)
katiecoart
PRO
2
12k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
1k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
2
6.3k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
1
280
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
460
Building Applications with DynamoDB
mza
96
7.2k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
330
The SEO identity crisis: Don't let AI make you average
varn
0
590
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
Designing for Performance
lara
612
70k
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