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
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
探して_入れて_作って_使う_Agent_Skills___LT.pdf
peintangos
2
120
string地獄を脱出する
sansantech
PRO
1
110
速さだけじゃない! VoidZero ツールが移行先に選ばれる理由
mizdra
PRO
6
710
Strands Agents超入門
kintotechdev
1
150
Claude Codeですべての日常業務を爆速化しよう!
minorun365
PRO
17
16k
開発を止めない CI/CD ~CI Visibilityによる継続的最適化~
pensuke628
0
220
AI時代の私の技術インプットとアウトプット術
tonkotsuboy_com
15
8.1k
Java正規表現エンジン(NFA)の仕組みと パフォーマンスを維持するための最適化手法
takeuchi_132917
0
160
AIプラットフォームを運用し続けるための可観測性
tanimuyk
4
830
Terraformモジュールは、なぜ「魔境」化するのか
hayama17
1
130
PHP と TypeScript の型システム比較:AI 時代の「型」は誰のためにあるのか? #frontend_phpcon_do / frontend_phpcon_do_2026
shogogg
1
210
最低限これだけ押さえれ大丈夫_Claude Enterprise/Team企業展開ガバナンス入門
tkikuchi
1
580
Featured
See All Featured
Game over? The fight for quality and originality in the time of robots
wayneb77
1
180
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.6k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
1.1k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
190
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
199
74k
Mobile First: as difficult as doing things right
swwweet
225
10k
Are puppies a ranking factor?
jonoalderson
1
3.4k
How to Talk to Developers About Accessibility
jct
2
210
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Optimizing for Happiness
mojombo
378
71k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
460
WCS-LA-2024
lcolladotor
0
610
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