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
Tejas Dinkar
July 19, 2014
Technology
1
410
Lightning - Monads you already use (without knowing it)
The lightning talk version of this talk.
Tejas Dinkar
July 19, 2014
Tweet
Share
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
380
Other Decks in Technology
See All in Technology
Amazon Rekognitionで 「信玄餅きなこ問題」を解決する
usanchuu
1
380
衛星画像即時マッピングサービスの実現に向けて
lehupa
1
280
GitHub Copilot CLI 現状確認会議(2026年2月のすがた)
torumakabe
2
340
Getting started with Google Antigravity
meteatamel
0
190
22nd ACRi Webinar - ChipTip Technology Eric-san's slide
nao_sumikawa
0
130
チーム開発の基礎_研究を事業につなげるために
cyberagentdevelopers
PRO
7
3.5k
Oracle Database@Google Cloud:サービス概要のご紹介
oracle4engineer
PRO
2
1k
AI時代のAPIファースト開発
nagix
1
140
Agent Skills 入門
puku0x
0
630
xDS を活用したサービスディスカバリーで実現するブランチ別 QA 環境の構築手法
knwoop
1
150
フルスタックGoでスコア改ざんを防いだ話
ponyo877
0
460
"共通化"と"Embed"のブレンドでスケール可能な運用を!M&Aを支えるGENDA SREの実践 / GENDA Tech Talk #3
genda
0
200
Featured
See All Featured
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.7k
How Software Deployment tools have changed in the past 20 years
geshan
0
32k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.2k
The Language of Interfaces
destraynor
162
26k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
330
Visualization
eitanlees
150
17k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
63
53k
The Spectacular Lies of Maps
axbom
PRO
1
550
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
190
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
1
60
Side Projects
sachag
455
43k
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