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
430
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
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
個人の発見を、組織の知恵に 〜生成AI活用を"探索"から"組織の仕組み"へ〜
kintotechdev
2
910
「気づいたら仕事が終わっている」バクラクAIエージェント本番運用の裏側 / layerx-bakuraku-aie2026
yuya4
18
9.8k
Djangoユーザが知っ得なPostgreSQL機能 - 設計の選択肢を増やす / Djang-use-PostgreSQL
soudai
PRO
0
170
新規事業を牽引する技術選定 〜フルスタックTypeScript開発の実践事例〜
nullnull
3
320
BigQuery の Cross-cloud Lakehouse への歩み
phaya72
2
550
美味しいスイスチーズを作ろう🧀🐭
taigamikami
1
230
最低限これだけ押さえれ大丈夫_Claude Enterprise/Team企業展開ガバナンス入門
tkikuchi
1
770
製造業のクラウド活用最適解〜AI,DXを加速するデータ基盤の作り方〜
hamadakoji
0
350
コードレビューを制するチームがソフトウェアデリバリーのフローを制す / Beyond Code Review: Distributing Its Responsibilities Across the SDLC
mtx2s
3
1k
Building applications in the Gemini API family.
line_developers_tw
PRO
0
950
ブロックチェーン / Blockchain
ks91
PRO
0
100
データ基盤をDataformで整えた話 〜 開発環境を添えて 〜
takapy
0
110
Featured
See All Featured
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
RailsConf 2023
tenderlove
30
1.5k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
960
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
220
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
200
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
520
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
310
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
65
55k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
200
WENDY [Excerpt]
tessaabrams
11
38k
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